@Override public AxisIterator iterateAxis(byte axisNumber) { return node.iterateAxis(axisNumber); } }
/** * Return an iterator over an axis, starting at the current node. * * @param axis the axis to iterate over, using a constant such as * {@link Axis#CHILD} * @param test a predicate to apply to the nodes before returning them. * @throws NullPointerException if there is no current node */ public AxisIterator iterateAxis(byte axis, NodeTest test) { return current.iterateAxis(axis, test); }
/** * Return an iterator over an axis, starting at the current node. * * @param axis the axis to iterate over, using a constant such as * {@link Axis#CHILD} * @param test a predicate to apply to the nodes before returning them. * @throws NullPointerException if there is no current node */ public AxisIterator iterateAxis(byte axis, NodeTest test) { return currentVirtualNode.iterateAxis(axis, test); }
/** * Return an iteration over the nodes reached by the given axis from this node * * @param axisNumber the axis to be used * @return a SequenceIterator that scans the nodes reached by the axis in turn. */ /*@Nullable*/ public AxisIterator iterateAxis(byte axisNumber) { return new WrappingIterator(node.iterateAxis(axisNumber), this, null); }
/** * Determine whether the node has any children. * * @return <code>true</code> if this node has any attributes, * <code>false</code> otherwise. */ public boolean hasChildNodes() { return node.iterateAxis(AxisInfo.CHILD).next() != null; }
/** * Return an iteration over the nodes reached by the given axis from this node * * @param axisNumber the axis to be used * @return a SequenceIterator that scans the nodes reached by the axis in turn. */ /*@Nullable*/ public AxisIterator iterateAxis(byte axisNumber) { return new WrappingIterator(node.iterateAxis(axisNumber), this, null); }
/** * Return an iterator over an axis, starting at the current node. * * @param axis the axis to iterate over, using a constant such as * {@link Axis#CHILD} * @param test a predicate to apply to the nodes before returning them. * @throws NullPointerException if there is no current node */ public AxisIterator iterateAxis(byte axis, NodeTest test) { return ((NodeInfo)current()).iterateAxis(axis, test); }
public static List<NodeInfo> makeAncestorList(NodeInfo origin) { List<NodeInfo> ancestors = new ArrayList<NodeInfo>(20); origin.iterateAxis(AxisInfo.ANCESTOR).forEach(ancestors::add); return ancestors; }
/** * Return an iterator over an axis, starting at the current node. * * @param axis the axis to iterate over, using a constant such as * {@link Axis#CHILD} * @param test a predicate to apply to the nodes before returning them. * @throws NullPointerException if there is no current node */ public AxisIterator iterateAxis(byte axis, NodeTest test) { return ((NodeInfo)current()).iterateAxis(axis, test); }
protected static List<Expression> getChildExpressionList(PackageLoaderHE loader, NodeInfo element) throws XPathException { List<Expression> children = new ArrayList<>(); AxisIterator iter = element.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT); NodeInfo child; while ((child = iter.next()) != null) { children.add(loader.loadExpression(child)); } return children; }
public NodeInfo getChildWithRole(NodeInfo parent, String role) { AxisIterator iter = parent.iterateAxis(AxisInfo.CHILD, NodeKindTest.ELEMENT); NodeInfo node; while ((node = iter.next()) != null) { String roleAtt = node.getAttributeValue("", "role"); if (role.equals(roleAtt)) { return node; } } return null; }
/** * Get the previous sibling of the node * * @return The previous sibling node. Returns null if the current node is the first * child of its parent. */ public Node getPreviousSibling() { return wrap(node.iterateAxis(AxisInfo.PRECEDING_SIBLING).next()); }
/** * Get next sibling node * * @return The next sibling node. Returns null if the current node is the last * child of its parent. */ public Node getNextSibling() { return wrap(node.iterateAxis(AxisInfo.FOLLOWING_SIBLING).next()); }
/** * Get first child * * @return the first child node of this node, or null if it has no children */ public Node getFirstChild() { return wrap(node.iterateAxis(AxisInfo.CHILD).next()); }
/** * Get number of attributes and namespaces (DOM NamedNodeMap method). */ public int getLength() { int length = 0; AxisIterator atts = parent.iterateAxis(AxisInfo.ATTRIBUTE); while (atts.next() != null) { length++; } return getNumberOfNamespaces() + length; }
/** * Get an iterator over the nodes reachable from this node via a given axis. * * @param axis identifies which axis is to be navigated * @return an iterator over the nodes on the specified axis, starting from this node as the * context node. The nodes are returned in axis order, that is, in document order for a forwards * axis and in reverse document order for a reverse axis. */ public XdmSequenceIterator<XdmNode> axisIterator(Axis axis) { AxisIterator base = getUnderlyingNode().iterateAxis(axis.getAxisNumber()); return XdmSequenceIterator.ofNodes(base); }
@Override public void markAttributeNode(NodeInfo origin) { NodeInfo element = builder.getCurrentParentNode(); markedNode = element.iterateAxis( AxisInfo.ATTRIBUTE, new SameNameTest(origin)).next(); mark = -1; }
@Override public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest) { if (nodeTest.getUType().intersection(UType.TEXT) == UType.VOID || axisNumber == AxisInfo.ATTRIBUTE || axisNumber == AxisInfo.NAMESPACE) { // iteration does not include text nodes, so no stripping needed return new WrappingIterator(node.iterateAxis(axisNumber, nodeTest), this, getParentForAxis(axisNumber)); } else { return new StrippingIterator(node.iterateAxis(axisNumber, nodeTest), getParentForAxis(axisNumber)); } }
@Override public void markNamespaceNode(NodeInfo origin) { NodeInfo element = builder.getCurrentParentNode(); NamePool pool = builder.getConfiguration().getNamePool(); String prefix = origin.getLocalPart(); markedNode = element.iterateAxis( AxisInfo.NAMESPACE, new NameTest(Type.NAMESPACE, "", prefix, pool)).next(); mark = -1; }
public void attribute(NodeName name, SimpleType typeCode, CharSequence value, Location locationId, int properties) throws XPathException { super.attribute(name, typeCode, value, locationId, properties); if (mark == Type.ATTRIBUTE) { NodeInfo element = builder.getCurrentParentNode(); markedNode = element.iterateAxis( AxisInfo.ATTRIBUTE, new NameTest(Type.ATTRIBUTE, name, builder.getConfiguration().getNamePool())).next(); mark = -1; } }