/** * 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()) {
&& 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"); } 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; }
/** * 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; } }
((ComplexType)type).isMixedContent())) {
!((ComplexType) parentType).isMixedContent() && !Whitespace.isWhite(getStringValueCS())) { XPathException err = new XPathException("Complex type " + parentType.getDescription() +
!((ComplexType)parentType).isMixedContent() && !Whitespace.isWhite(getStringValueCS())) { XPathException err = new XPathException("Complex type " + parentType.getDescription() +
!((ComplexType)parentType).isMixedContent() && !Whitespace.isWhite(getStringValueCS())) { XPathException err = new XPathException("Complex type " + parentType.getDescription() +
!((ComplexType) parentType).isMixedContent() && !Whitespace.isWhite(getStringValueCS())) { XPathException err = new XPathException("Complex type " + parentType.getDescription() +
!((ComplexType)parentType).isMixedContent() && !Whitespace.isWhite(selectValue.getStringValue())) { XPathException err = new XPathException("Complex type " + parentType.getDescription() +
!((ComplexType)parentType).isMixedContent() && !Whitespace.isWhite(selectValue.getStringValue())) { XPathException err = new XPathException("Complex type " + parentType.getDescription() +
!((ComplexType) parentType).isMixedContent() && !Whitespace.isWhite(selectValue.getStringValue())) { XPathException err = new XPathException("The containing element must be of type " + parentType.getDescription() +
!((ComplexType) parentType).isMixedContent() && !Whitespace.isWhite(selectValue.getStringValue())) { XPathException err = new XPathException("The containing element must be of type " + parentType.getDescription() +