/** * Return a string representation of this ItemType suitable for use in stylesheet * export files. This differs from the result of toString() in that it will not contain * any references to anonymous types. Note that it may also use the Saxon extended syntax * for union types and tuple types. The default implementation returns the result of * calling {@code toString()}. * * @return the string representation as an instance of the XPath SequenceType construct */ @Override public String toExportString() { return (kind == Type.ELEMENT ? "element(*, " : "attribute(*, ") + schemaType.getNearestNamedType().getEQName() + ')'; }
/** * Return a string representation of this ItemType suitable for use in stylesheet * export files. This differs from the result of toString() in that it will not contain * any references to anonymous types. Note that it may also use the Saxon extended syntax * for union types and tuple types. The default implementation returns the result of * calling {@code toString()}. * * @return the string representation as an instance of the XPath SequenceType construct */ @Override public String toExportString() { return (kind == Type.ELEMENT ? "element(*, " : "attribute(*, ") + schemaType.getNearestNamedType().getEQName() + ')'; }
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 + ')'; } }