public void startElement(NodeName elemName, SchemaType type, Location location, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(elemName, type, location, properties); byte preserveParent = stripStack[top]; byte preserve = (byte) (preserveParent & (PRESERVE_PARENT | ASSERTIONS_EXIST)); int elementStrip = isSpacePreserving(elemName, type); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (type != Untyped.getInstance()) { if (preserve == 0) { // if the element has simple content, whitespace stripping is disabled if (type.isSimpleType() || ((ComplexType) type).isSimpleContent()) { preserve |= SIMPLE_CONTENT; } } if (type instanceof ComplexType && ((ComplexType) type).hasAssertions()) { preserve |= ASSERTIONS_EXIST; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { stripStack = Arrays.copyOf(stripStack, top * 2); } stripStack[top] = preserve; }
public void startElement(NodeName elemName, SchemaType type, Location location, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(elemName, type, location, properties); byte preserveParent = stripStack[top]; byte preserve = (byte) (preserveParent & (PRESERVE_PARENT | ASSERTIONS_EXIST)); int elementStrip = isSpacePreserving(elemName, type); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (type != Untyped.getInstance()) { if (preserve == 0) { // if the element has simple content, whitespace stripping is disabled if (type.isSimpleType() || ((ComplexType) type).isSimpleContent()) { preserve |= SIMPLE_CONTENT; } } if (type instanceof ComplexType && ((ComplexType) type).hasAssertions()) { preserve |= ASSERTIONS_EXIST; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { stripStack = Arrays.copyOf(stripStack, top * 2); } stripStack[top] = preserve; }
/** * 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; } }
if (t instanceof ComplexType && ((ComplexType) t).hasAssertions()) { return true;
if (t instanceof ComplexType && ((ComplexType) t).hasAssertions()) { return true;