public void validate(ComponentDeclaration decl) throws XPathException { if (select != null && hasChildNodes()) { String errorCode = getErrorCodeForSelectPlusContent(); compileError("An " + getDisplayName() + " element with a select attribute must be empty", errorCode); } AxisIterator kids = iterateAxis(AxisInfo.CHILD); NodeInfo first = kids.next(); if (select == null) { if (first == null) { // there are no child nodes and no select attribute //stringValue = ""; select = new StringLiteral(StringValue.EMPTY_STRING); select.setRetainedStaticContext(makeRetainedStaticContext()); } else { if (kids.next() == null && !isExpandingText()) { // there is exactly one child node if (first.getNodeKind() == Type.TEXT) { // it is a text node: optimize for this case select = new StringLiteral(first.getStringValue()); select.setRetainedStaticContext(makeRetainedStaticContext()); } } } } }
public void validate(ComponentDeclaration decl) throws XPathException { if (select != null && hasChildNodes()) { String errorCode = getErrorCodeForSelectPlusContent(); compileError("An " + getDisplayName() + " element with a select attribute must be empty", errorCode); } AxisIterator kids = iterateAxis(AxisInfo.CHILD); NodeInfo first = kids.next(); if (select == null) { if (first == null) { // there are no child nodes and no select attribute //stringValue = ""; select = new StringLiteral(StringValue.EMPTY_STRING); select.setRetainedStaticContext(makeRetainedStaticContext()); } else { if (kids.next() == null && !isExpandingText()) { // there is exactly one child node if (first.getNodeKind() == Type.TEXT) { // it is a text node: optimize for this case select = new StringLiteral(first.getStringValue()); select.setRetainedStaticContext(makeRetainedStaticContext()); } } } } }