@Override public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.DESCENDANT: return new Navigator.DescendantEnumeration(this, false, true); case Axis.DESCENDANT_OR_SELF: return new Navigator.DescendantEnumeration(this, true, true); case Axis.CHILD: return SingleNodeIterator.makeIterator(rootNode); default: return super.iterateAxis(axisNumber); } } }
return super.iterateAxis(axisNumber); case Axis.PARENT: return SingleNodeIterator.makeIterator(parent); case Axis.PRECEDING: return new Navigator.PrecedingEnumeration(this, false); return SingleNodeIterator.makeIterator(this); case Axis.PRECEDING_OR_ANCESTOR: return new Navigator.PrecedingEnumeration(this, true);
static AxisIterator createSingletonAxisIterator(NodeInfo nodeInfo) { return SingleNodeIterator.makeIterator(nodeInfo); }
/** * Return an iteration over the nodes reached by the given axis from this node * @param axisNumber the axis to be searched, e.g. Axis.CHILD or Axis.ANCESTOR * @return a SequenceIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR_OR_SELF: case Axis.DESCENDANT_OR_SELF: case Axis.SELF: return SingleNodeIterator.makeIterator(this); case Axis.ANCESTOR: case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PARENT: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: case Axis.PRECEDING_OR_ANCESTOR: return EmptyIterator.getInstance(); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
/** * Return an iteration over the nodes reached by the given axis from this node * @param axisNumber the axis to be searched, e.g. Axis.CHILD or Axis.ANCESTOR * @return a SequenceIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR_OR_SELF: case Axis.DESCENDANT_OR_SELF: case Axis.SELF: return SingleNodeIterator.makeIterator(this); case Axis.ANCESTOR: case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PARENT: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: case Axis.PRECEDING_OR_ANCESTOR: return EmptyIterator.getInstance(); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
/** * Return an enumeration over the nodes reached by the given axis from this node * @param axisNumber the axis to be iterated over * @return a AxisIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR: case Axis.PARENT: case Axis.PRECEDING_OR_ANCESTOR: return SingleNodeIterator.makeIterator(TextFragmentValue.this); case Axis.ANCESTOR_OR_SELF: NodeInfo[] nodes = {this, TextFragmentValue.this}; return new NodeArrayIterator(nodes); case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: return EmptyIterator.getInstance(); case Axis.SELF: case Axis.DESCENDANT_OR_SELF: return SingleNodeIterator.makeIterator(this); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
/** * Return an iteration over the nodes reached by the given axis from this node * @param axisNumber the axis to be searched, e.g. Axis.CHILD or Axis.ANCESTOR * @return a SequenceIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR_OR_SELF: case Axis.DESCENDANT_OR_SELF: case Axis.SELF: return SingleNodeIterator.makeIterator(this); case Axis.ANCESTOR: case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PARENT: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: case Axis.PRECEDING_OR_ANCESTOR: return EmptyIterator.getInstance(); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
/** * Return an enumeration over the nodes reached by the given axis from this node * @param axisNumber the axis to be iterated over * @return a AxisIterator that scans the nodes reached by the axis in turn. */ public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.ANCESTOR: case Axis.PARENT: case Axis.PRECEDING_OR_ANCESTOR: return SingleNodeIterator.makeIterator(TextFragmentValue.this); case Axis.ANCESTOR_OR_SELF: NodeInfo[] nodes = {this, TextFragmentValue.this}; return new NodeArrayIterator(nodes); case Axis.ATTRIBUTE: case Axis.CHILD: case Axis.DESCENDANT: case Axis.FOLLOWING: case Axis.FOLLOWING_SIBLING: case Axis.NAMESPACE: case Axis.PRECEDING: case Axis.PRECEDING_SIBLING: return EmptyIterator.getInstance(); case Axis.SELF: case Axis.DESCENDANT_OR_SELF: return SingleNodeIterator.makeIterator(this); default: throw new IllegalArgumentException("Unknown axis number " + axisNumber); } }
/** * Create an iterator over a singleton node, if it exists and matches a nodetest; * otherwise return an empty iterator * @param node the singleton node, or null if the node does not exist * @param nodeTest the test to be applied * @return an iterator over the node if it exists and matches the test. */ public static AxisIterator filteredSingleton(NodeInfo node, NodeTest nodeTest) { if (node != null && nodeTest.matches(node)) { return SingleNodeIterator.makeIterator(node); } else { return EmptyIterator.getInstance(); } }
/** * Create an iterator over a singleton node, if it exists and matches a nodetest; * otherwise return an empty iterator * @param node the singleton node, or null if the node does not exist * @param nodeTest the test to be applied * @return an iterator over the node if it exists and matches the test. */ public static AxisIterator filteredSingleton(NodeInfo node, NodeTest nodeTest) { if (node != null && nodeTest.matches(node)) { return SingleNodeIterator.makeIterator(node); } else { return EmptyIterator.getInstance(); } }
return SingleNodeIterator.makeIterator(this); return SingleNodeIterator.makeIterator(getTextNode());
return SingleNodeIterator.makeIterator(this); return SingleNodeIterator.makeIterator(getTextNode());
@Override public AxisIterator iterateAxis(byte axisNumber) { switch (axisNumber) { case Axis.DESCENDANT: return new Navigator.DescendantEnumeration(this, false, true); case Axis.DESCENDANT_OR_SELF: return new Navigator.DescendantEnumeration(this, true, true); case Axis.CHILD: return SingleNodeIterator.makeIterator(rootNode); default: return super.iterateAxis(axisNumber); } } }
static AxisIterator createParentAxisIterator(XmlObjectNode xmlObjectNode, NodeTest nodeTest, Configuration configuration) { XmlObject parent = xmlObjectNode.getXmlObjectParent(); if (parent == null) return createEmptyAxisIterator(); XmlObjectNodeNodeInfo parentNodeInfo = wrapXmlObjectAsNodeInfo(parent, configuration); if (!nodeTest.matches(parentNodeInfo)) return createEmptyAxisIterator(); return SingleNodeIterator.makeIterator(parentNodeInfo); }
/** * Get an enumeration of the children of this node * @param test A NodeTest to be satisfied by the child nodes, or null * if all child node are to be returned * @return an iterator over the children of this node */ protected final AxisIterator enumerateChildren(NodeTest test) { if (children==null) { return EmptyIterator.getInstance(); } else if (children instanceof NodeImpl) { NodeImpl child = (NodeImpl)children; if (test == null || test instanceof AnyNodeTest) { return SingleNodeIterator.makeIterator(child); } else { return Navigator.filteredSingleton(child, test); } } else { if (test == null || test instanceof AnyNodeTest) { return new NodeArrayIterator((NodeImpl[])children); } else { return new ChildEnumeration(this, test); } } }
return new NodeArrayIterator(nodes); } else if (matchesDoc && !matchesText) { return SingleNodeIterator.makeIterator(TextFragmentValue.this); } else if (matchesText && !matchesDoc) { return SingleNodeIterator.makeIterator(this); } else { return EmptyIterator.getInstance();
return new NodeArrayIterator(nodes); } else if (matchesDoc && !matchesText) { return SingleNodeIterator.makeIterator(TextFragmentValue.this); } else if (matchesText && !matchesDoc) { return SingleNodeIterator.makeIterator(this); } else { return EmptyIterator.getInstance();
/** * Get an enumeration of the children of this node * @param test A NodeTest to be satisfied by the child nodes, or null * if all child node are to be returned * @return an iterator over the children of this node */ protected final AxisIterator enumerateChildren(NodeTest test) { if (children==null) { return EmptyIterator.getInstance(); } else if (children instanceof NodeImpl) { NodeImpl child = (NodeImpl)children; if (test == null || test instanceof AnyNodeTest) { return SingleNodeIterator.makeIterator(child); } else { return Navigator.filteredSingleton(child, test); } } else { if (test == null || test instanceof AnyNodeTest) { return new NodeArrayIterator((NodeImpl[])children); } else { return new ChildEnumeration(this, test); } } }
return new NodeArrayIterator(pair); } else { return SingleNodeIterator.makeIterator(this); return SingleNodeIterator.makeIterator(textNode2); } else { return EmptyIterator.getInstance();
return createEmptyAxisIterator(); case Axis.CHILD: return SingleNodeIterator.makeIterator(wrapXmlObjectAsNodeInfo(rootXmlObject, configuration)); case Axis.DESCENDANT: return createDescendantIterator(rootXmlObject, nodeTest, configuration);