/** * Ask whether values of this type are atomizable * * @return true unless it is known that these items will be elements with element-only * content, in which case return false * @param th The type hierarchy cache */ public boolean isAtomizable(TypeHierarchy th) { return !(schemaType.isComplexType() && ((ComplexType) schemaType).getVariety() == ComplexType.VARIETY_ELEMENT_ONLY); }
/** * Ask whether values of this type are atomizable * * @return true unless it is known that these items will be elements with element-only * content, in which case return false * @param th The type hierarchy cache */ public boolean isAtomizable(TypeHierarchy th) { return !(schemaType.isComplexType() && ((ComplexType) schemaType).getVariety() == ComplexType.VARIETY_ELEMENT_ONLY); }
/** * Decide whether an element is in the set of white-space preserving element types * * @param name identifies the name of the element being tested * @param schemaType the type annotation of the element being tested * @return STRIP_DEFAULT: strip spaces unless xml:space tells you not to. */ public int isSpacePreserving(NodeName name, SchemaType schemaType) { if (schemaType != Untyped.getInstance() && schemaType.isComplexType() && !((ComplexType) schemaType).isSimpleContent() && !((ComplexType) schemaType).isMixedContent()) { return Stripper.ALWAYS_STRIP; } else { return Stripper.ALWAYS_PRESERVE; } }
/** * Decide whether an element is in the set of white-space preserving element types * * @param name identifies the name of the element being tested * @param schemaType the type annotation of the element being tested * @return STRIP_DEFAULT: strip spaces unless xml:space tells you not to. */ public int isSpacePreserving(NodeName name, SchemaType schemaType) { if (schemaType != Untyped.getInstance() && schemaType.isComplexType() && !((ComplexType) schemaType).isSimpleContent() && !((ComplexType) schemaType).isMixedContent()) { return Stripper.ALWAYS_STRIP; } else { return Stripper.ALWAYS_PRESERVE; } }
public void startElement(NodeName nameCode, SchemaType type, Location location, int properties) throws XPathException { //System.err.println("startElement " + getNamePool().getDisplayName(nameCode)); nextReceiver.startElement(nameCode, type, location, properties); boolean strip = false; if (type != Untyped.getInstance()) { // if the element has element-only content, whitespace stripping is enabled if (type.isComplexType() && !((ComplexType) type).isSimpleContent() && !((ComplexType) type).isMixedContent()) { strip = true; } } //System.err.println("strip = " + strip); // put "strip" value on top of stack top++; if (top >= stripStack.length) { stripStack = Arrays.copyOf(stripStack, top*2); } stripStack[top] = strip; }
public void startElement(NodeName nameCode, SchemaType type, Location location, int properties) throws XPathException { //System.err.println("startElement " + getNamePool().getDisplayName(nameCode)); nextReceiver.startElement(nameCode, type, location, properties); boolean strip = false; if (type != Untyped.getInstance()) { // if the element has element-only content, whitespace stripping is enabled if (type.isComplexType() && !((ComplexType) type).isSimpleContent() && !((ComplexType) type).isMixedContent()) { strip = true; } } //System.err.println("strip = " + strip); // put "strip" value on top of stack top++; if (top >= stripStack.length) { stripStack = Arrays.copyOf(stripStack, top*2); } stripStack[top] = strip; }
/** * Returns whether this text node contains <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'> * element content whitespace</a>, often abusively called "ignorable whitespace". The text node is * determined to contain whitespace in element content during the load * of the document or if validation occurs while using * <code>Document.normalizeDocument()</code>. * * @since DOM Level 3 */ public boolean isElementContentWhitespace() { if (node.getNodeKind() != Type.TEXT) { throw new UnsupportedOperationException("Method is defined only on text nodes"); } if (!Whitespace.isWhite(node.getStringValue())) { return false; } NodeInfo parent = node.getParent(); if (parent == null) { return false; } SchemaType type = parent.getSchemaType(); return type.isComplexType() && !((ComplexType) type).isMixedContent(); }
/** * Returns whether this text node contains <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'> * element content whitespace</a>, often abusively called "ignorable whitespace". The text node is * determined to contain whitespace in element content during the load * of the document or if validation occurs while using * <code>Document.normalizeDocument()</code>. * * @since DOM Level 3 */ public boolean isElementContentWhitespace() { if (node.getNodeKind() != Type.TEXT) { throw new UnsupportedOperationException("Method is defined only on text nodes"); } if (!Whitespace.isWhite(node.getStringValue())) { return false; } NodeInfo parent = node.getParent(); if (parent == null) { return false; } SchemaType type = parent.getSchemaType(); return type.isComplexType() && !((ComplexType) type).isMixedContent(); }
&& type.isComplexType() && ((ComplexType) type).isMixedContent()) {
/** * Determine whether the wrapped document contains any nodes annotated with complex types that * define assertions. * * @param doc the wrapper of the document node * @return true if any element in the document has an xml:space attribute with the value "preserve" */ private static boolean findAssertions(/*@NotNull*/ TreeInfo doc) { if (doc.isTyped()) { AxisIterator iter = doc.getRootNode().iterateAxis(AxisInfo.DESCENDANT, NodeKindTest.ELEMENT); while (true) { NodeInfo node = iter.next(); if (node == null) { return false; } SchemaType type = node.getSchemaType(); if (type.isComplexType() && ((ComplexType) type).hasAssertions()) { return true; } } } else { return false; } }
/** * Determine whether the wrapped document contains any nodes annotated with complex types that * define assertions. * * @param doc the wrapper of the document node * @return true if any element in the document has an xml:space attribute with the value "preserve" */ private static boolean findAssertions(/*@NotNull*/ TreeInfo doc) { if (doc.isTyped()) { AxisIterator iter = doc.getRootNode().iterateAxis(AxisInfo.DESCENDANT, NodeKindTest.ELEMENT); while (true) { NodeInfo node = iter.next(); if (node == null) { return false; } SchemaType type = node.getSchemaType(); if (type.isComplexType() && ((ComplexType) type).hasAssertions()) { return true; } } } else { return false; } }
/** * Simplify type so that hierarchy comparison could be accurate. */ private ItemType simplify(ItemType it) { TypeHierarchy th = processor.getUnderlyingConfiguration().getTypeHierarchy(); if (it instanceof CombinedNodeTest) { CombinedNodeTest n = (CombinedNodeTest) it; __log.debug(n.getComponentNodeTests()); return simplify(n.getComponentNodeTests()[1]); } else if (it instanceof NodeTest) { NodeTest n = (NodeTest) it; __log.debug(n); SchemaType t = n.getContentType(); if (t.isSimpleType() || t.equals(AnyType.getInstance())) { AtomicType at = it.getAtomizedItemType(); while (!at.isBuiltInType()) at = at.getSuperType(th).getAtomizedItemType(); return at; } else if (t.isComplexType()) { return n; } else { return AnyItemType.getInstance(); } } else { if (it == null) return null; else return it.getAtomizedItemType(); } }
/** * Output element start tag */ public void startElement(int nameCode, int typeCode, int locationId, int properties) throws XPathException { if (afterStartTag || afterEndTag) { indent(); } nextReceiver.startElement(nameCode, typeCode, locationId, properties); level++; sameline = true; afterStartTag = true; afterEndTag = false; allWhite = true; line = 0; SchemaType type; if (suppressedElements != null && suppressedElements.contains(nameCode&NamePool.FP_MASK)) { suppressedAtLevel = level; } if (typeCode >= 1024 && suppressedAtLevel < 0 && ((type = getConfiguration().getSchemaType(typeCode)).isComplexType() && ((ComplexType)type).isMixedContent())) { // suppress indentation for elements with mixed content. (Note this also suppresses // indentation for all descendants of such elements. We could be smarter than this.) suppressedAtLevel = level; } }
/** * Returns whether this text node contains <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'> * element content whitespace</a>, often abusively called "ignorable whitespace". The text node is * determined to contain whitespace in element content during the load * of the document or if validation occurs while using * <code>Document.normalizeDocument()</code>. * * @since DOM Level 3 */ public boolean isElementContentWhitespace() { if (node.getNodeKind() != Type.TEXT) { throw new UnsupportedOperationException("Method is defined only on text nodes"); } int annotation = node.getParent().getTypeAnnotation(); if (annotation == -1) { return false; } if (!Whitespace.isWhite(node.getStringValue())) { return false; } SchemaType type = node.getConfiguration().getSchemaType(annotation); if (!type.isComplexType()) { return false; } if (((ComplexType)type).isMixedContent()) { return false; } return true; }
public boolean isAvailable(SymbolicName.F functionName) { if (functionName.getArity() != 1) { return false; } final String uri = functionName.getComponentName().getURI(); final String localName = functionName.getComponentName().getLocalPart(); final SchemaType type = config.getSchemaType(new StructuredQName("", uri, localName)); if (type == null || type.isComplexType()) { return false; } if (type.isAtomicType() && ((AtomicType) type).isAbstract()) { return false; } return type != AnySimpleType.getInstance(); }
public boolean isAvailable(SymbolicName.F functionName) { if (functionName.getArity() != 1) { return false; } final String uri = functionName.getComponentName().getURI(); final String localName = functionName.getComponentName().getLocalPart(); final SchemaType type = config.getSchemaType(new StructuredQName("", uri, localName)); if (type == null || type.isComplexType()) { return false; } if (type.isAtomicType() && ((AtomicType) type).isAbstract()) { return false; } return type != AnySimpleType.getInstance(); }
((type = getConfiguration().getSchemaType(typeCode)) != null && type.isComplexType() && ((ComplexType)type).isMixedContent())) {
private void computeSingleValued(TypeHierarchy th) { ItemType operandType = getOperandItemType(); if (th.relationship(operandType, ArrayItemType.ANY_ARRAY_TYPE) != TypeHierarchy.DISJOINT) { singleValued = false; } else { singleValued = untyped; if (!singleValued) { ItemType nodeType = getBaseExpression().getItemType(); if (nodeType instanceof NodeTest) { SchemaType st = ((NodeTest) nodeType).getContentType(); if (st == Untyped.getInstance() || st.isAtomicType() || (st.isComplexType() && st != AnyType.getInstance())) { singleValued = true; } if (!nodeType.getUType().overlaps(UType.ELEMENT.union(UType.ATTRIBUTE))) { singleValued = true; } } } } }
private void computeSingleValued(TypeHierarchy th) { ItemType operandType = getOperandItemType(); if (th.relationship(operandType, ArrayItemType.ANY_ARRAY_TYPE) != TypeHierarchy.DISJOINT) { singleValued = false; } else { singleValued = untyped; if (!singleValued) { ItemType nodeType = getBaseExpression().getItemType(); if (nodeType instanceof NodeTest) { SchemaType st = ((NodeTest) nodeType).getContentType(); if (st == Untyped.getInstance() || st.isAtomicType() || (st.isComplexType() && st != AnyType.getInstance())) { singleValued = true; } if (!nodeType.getUType().overlaps(UType.ELEMENT.union(UType.ATTRIBUTE))) { singleValued = true; } } } } }
return ((ListType)type).getBuiltInBaseType().getFingerprint() == StandardNames.XS_IDREFS; if (type.isComplexType() && ((ComplexType)type).isSimpleContent()) { SimpleType contentType = ((ComplexType)type).getSimpleContentType(); if (contentType.isAtomicType()) {