public String toString() { if (isGlobalComponentTest) { if (nodetest1 instanceof SubstitutionGroupTest) { return nodetest1.toString(); } else { final int kind = nodetest1.getPrimitiveType(); final String skind = (kind == Type.ELEMENT ? "schema-element(" : "schema-attribute("); final String name = nodetest1.toString(); return skind + name + ')'; } } else if (nodetest1 instanceof NameTest && operator==Token.INTERSECT) { int kind = nodetest1.getPrimitiveType(); String skind = (kind == Type.ELEMENT ? "element(" : "attribute("); String content = ""; if (nodetest2 instanceof ContentTypeTest) { final SchemaType schemaType = ((ContentTypeTest)nodetest2).getSchemaType(); content = ", " + schemaType.getFingerprint(); } String name = nodetest1.toString(); return skind + name + content + ')'; } else { String nt1 = (nodetest1==null ? "true()" : nodetest1.toString()); String nt2 = (nodetest2==null ? "true()" : nodetest2.toString()); return '(' + nt1 + ' ' + Token.tokens[operator] + ' ' + nt2 + ')'; } }
public String toString() { if (isGlobalComponentTest) { if (nodetest1 instanceof SubstitutionGroupTest) { return nodetest1.toString(); } else { final int kind = nodetest1.getPrimitiveType(); final String skind = (kind == Type.ELEMENT ? "schema-element(" : "schema-attribute("); final String name = nodetest1.toString(); return skind + name + ')'; } } else if (nodetest1 instanceof NameTest && operator==Token.INTERSECT) { int kind = nodetest1.getPrimitiveType(); String skind = (kind == Type.ELEMENT ? "element(" : "attribute("); String content = ""; if (nodetest2 instanceof ContentTypeTest) { final SchemaType schemaType = ((ContentTypeTest)nodetest2).getSchemaType(); content = ", " + schemaType.getFingerprint(); } String name = nodetest1.toString(); return skind + name + content + ')'; } else { String nt1 = (nodetest1==null ? "true()" : nodetest1.toString()); String nt2 = (nodetest2==null ? "true()" : nodetest2.toString()); return '(' + nt1 + ' ' + Token.tokens[operator] + ' ' + nt2 + ')'; } }
private String makeString(boolean forExport) { if (nodetest1 instanceof NameTest && operator == Token.INTERSECT) { int kind = nodetest1.getPrimitiveType(); String skind = kind == Type.ELEMENT ? "element(" : "attribute("; String content = ""; if (nodetest2 instanceof ContentTypeTest) { SchemaType schemaType = ((ContentTypeTest) nodetest2).getSchemaType(); if (forExport) { schemaType = schemaType.getNearestNamedType(); } content = ", " + schemaType.getEQName(); if (nodetest2.isNillable()) { content += "?"; } } String name; if (nodetest1 instanceof NameTest) { name = nodetest1.getMatchingNodeName().getEQName(); } else { name = nodetest1.toString(); } return skind + name + content + ')'; } else { String nt1 = nodetest1 == null ? "item()" : nodetest1.toString(); String nt2 = nodetest2 == null ? "item()" : nodetest2.toString(); return '(' + nt1 + ' ' + Token.tokens[operator] + ' ' + nt2 + ')'; } }
private String makeString(boolean forExport) { if (nodetest1 instanceof NameTest && operator == Token.INTERSECT) { int kind = nodetest1.getPrimitiveType(); String skind = kind == Type.ELEMENT ? "element(" : "attribute("; String content = ""; if (nodetest2 instanceof ContentTypeTest) { SchemaType schemaType = ((ContentTypeTest) nodetest2).getSchemaType(); if (forExport) { schemaType = schemaType.getNearestNamedType(); } content = ", " + schemaType.getEQName(); if (nodetest2.isNillable()) { content += "?"; } } String name = nodetest1.getMatchingNodeName().getEQName(); return skind + name + content + ')'; } else { String nt1 = nodetest1 == null ? "item()" : nodetest1.toString(); String nt2 = nodetest2 == null ? "item()" : nodetest2.toString(); return '(' + nt1 + ' ' + Token.tokens[operator] + ' ' + nt2 + ')'; } }
/** * Add the "parameters" of the type to a Dictionary containing the type information * in structured form */ public void addTypeDetails(DictionaryMap map) { if (nodetest1 instanceof NameTest && operator == Token.INTERSECT) { map.initialPut("n", new StringValue(nodetest1.getMatchingNodeName().getEQName())); if (nodetest2 instanceof ContentTypeTest) { SchemaType schemaType = ((ContentTypeTest) nodetest2).getSchemaType(); if (schemaType != Untyped.getInstance() && schemaType != BuiltInAtomicType.UNTYPED_ATOMIC) { map.initialPut("c", new StringValue(schemaType.getEQName() + (nodetest2.isNillable() ? "?" : ""))); } } } }
/** * Check that a SequenceType used in the definition of an imported variable or function * is available in the importing module * @param importedType the type that is to be checked * @param declaration the containing query or function definition * @throws net.sf.saxon.trans.XPathException if an error is fonnd. */ public void checkImportedType(SequenceType importedType, Declaration declaration) throws XPathException { ItemType type = importedType.getPrimaryType(); if (type instanceof AnyItemType) { return; } if (type.isAtomicType()) { int f = ((AtomicType)type).getFingerprint(); checkSchemaNamespaceImported(f, declaration); } else if (type instanceof ContentTypeTest) { SchemaType annotation = ((ContentTypeTest)type).getSchemaType(); int f = annotation.getFingerprint(); checkSchemaNamespaceImported(f, declaration); } else if (type instanceof CombinedNodeTest) { NodeTest[] tests = ((CombinedNodeTest)type).getComponentNodeTests(); for (int i=0; i<tests.length; i++) { SequenceType st = SequenceType.makeSequenceType(tests[i], StaticProperty.EXACTLY_ONE); checkImportedType(st, declaration); } } }
/** * Check that a SequenceType used in the definition of an imported variable or function * is available in the importing module * @param importedType the type that is to be checked * @param declaration the containing query or function definition * @throws net.sf.saxon.trans.XPathException if an error is fonnd. */ public void checkImportedType(SequenceType importedType, Declaration declaration) throws XPathException { ItemType type = importedType.getPrimaryType(); if (type instanceof AnyItemType) { return; } if (type.isAtomicType()) { int f = ((AtomicType)type).getFingerprint(); checkSchemaNamespaceImported(f, declaration); } else if (type instanceof ContentTypeTest) { SchemaType annotation = ((ContentTypeTest)type).getSchemaType(); int f = annotation.getFingerprint(); checkSchemaNamespaceImported(f, declaration); } else if (type instanceof CombinedNodeTest) { NodeTest[] tests = ((CombinedNodeTest)type).getComponentNodeTests(); for (int i=0; i<tests.length; i++) { SequenceType st = SequenceType.makeSequenceType(tests[i], StaticProperty.EXACTLY_ONE); checkImportedType(st, declaration); } } }
public String toString(NamePool pool) { if (isGlobalComponentTest) { if (nodetest1 instanceof SubstitutionGroupTest) { return nodetest1.toString(pool); } else { final int kind = nodetest1.getPrimitiveType(); final String skind = (kind == Type.ELEMENT ? "schema-element(" : "schema-attribute("); final String name = pool.getClarkName(nodetest1.getFingerprint()); return skind + name + ')'; } } else if (nodetest1 instanceof NameTest && operator==Token.INTERSECT) { int kind = nodetest1.getPrimitiveType(); String skind = (kind == Type.ELEMENT ? "element(" : "attribute("); String content = ""; if (nodetest2 instanceof ContentTypeTest) { final SchemaType schemaType = ((ContentTypeTest)nodetest2).getSchemaType(); content = ", " + pool.getClarkName(schemaType.getFingerprint()); } String name = pool.getClarkName(nodetest1.getFingerprint()); return skind + name + content + ')'; } else { String nt1 = (nodetest1==null ? "true()" : nodetest1.toString(pool)); String nt2 = (nodetest2==null ? "true()" : nodetest2.toString(pool)); return '(' + nt1 + ' ' + Token.tokens[operator] + ' ' + nt2 + ')'; } }
public String toString(NamePool pool) { if (isGlobalComponentTest) { if (nodetest1 instanceof SubstitutionGroupTest) { return nodetest1.toString(pool); } else { final int kind = nodetest1.getPrimitiveType(); final String skind = (kind == Type.ELEMENT ? "schema-element(" : "schema-attribute("); final String name = pool.getClarkName(nodetest1.getFingerprint()); return skind + name + ')'; } } else if (nodetest1 instanceof NameTest && operator==Token.INTERSECT) { int kind = nodetest1.getPrimitiveType(); String skind = (kind == Type.ELEMENT ? "element(" : "attribute("); String content = ""; if (nodetest2 instanceof ContentTypeTest) { final SchemaType schemaType = ((ContentTypeTest)nodetest2).getSchemaType(); content = ", " + pool.getClarkName(schemaType.getFingerprint()); } String name = pool.getClarkName(nodetest1.getFingerprint()); return skind + name + content + ')'; } else { String nt1 = (nodetest1==null ? "true()" : nodetest1.toString(pool)); String nt2 = (nodetest2==null ? "true()" : nodetest2.toString(pool)); return '(' + nt1 + ' ' + Token.tokens[operator] + ' ' + nt2 + ')'; } }