/** * Determines axis iteration algorithm. * @param axisNumber element from {@code AxisInfo} * @param nodeTest filter for iterator * @return {@code AxisIterator} object */ @Override public AxisIterator iterateAxis(byte axisNumber, NodeTest nodeTest) { AxisIterator axisIterator = iterateAxis(axisNumber); if (nodeTest != null) { axisIterator = new Navigator.AxisFilter(axisIterator, nodeTest); } return axisIterator; }
switch (axisNumber) { case AxisInfo.ANCESTOR: try (AxisIterator iterator = new Navigator.AncestorEnumeration(this, false)) { result = iterator; try (AxisIterator iterator = new Navigator.AncestorEnumeration(this, true)) { result = iterator; if (hasChildNodes()) { try (AxisIterator iterator = new Navigator.DescendantEnumeration(this, false, true)) { result = iterator; case AxisInfo.DESCENDANT_OR_SELF: try (AxisIterator iterator = new Navigator.DescendantEnumeration(this, true, true)) { result = iterator;
if (hasChildNodes()) { try (AxisIterator iterator = new Navigator.DescendantEnumeration(this, false, true)) { result = iterator; case AxisInfo.DESCENDANT_OR_SELF: try (AxisIterator iterator = new Navigator.DescendantEnumeration(this, true, true)) { result = iterator;
public N step(N node) { do { node = getFollowingNode(node, anchor); } while (node != null && node.getFingerprint() != fingerprint); return node; } }
/** * Returns an iterator over the in-scope namespace bindings of the element. * * @return an Iterator. */ @Override public Iterator<NamespaceBinding> iterator() { return NamespaceIterator.iterateNamespaces(element); } }
/** * Get the value of an attribute (by name). * * @param uri The namespace uri of the attribute. * @param localname The local name of the attribute. * @return The index position of the attribute */ /*@Nullable*/ public String getValue(String uri, String localname) { int index = findByName(uri, localname); return (index < 0 ? null : getValue(index)); }
/** * Get the attribute value using its fingerprint */ /*@Nullable*/ public String getValueByFingerprint(int fingerprint) { int index = findByFingerprint(fingerprint); return (index < 0 ? null : getValue(index)); }
/** * Get a character string that uniquely identifies this node. * Note: a.isSameNode(b) if and only if generateId(a)==generateId(b) * * @param buffer a buffer to contain a string that uniquely identifies this node, across all * documents */ public void generateId(FastStringBuffer buffer) { Navigator.appendSequentialKey(this, buffer, true); }
/** * Ask whether the node has the disable-output-escaping property * @return true if the node has the disable-output-escaping property */ public boolean isDisableOutputEscaping() { return isOption(ReceiverOptions.DISABLE_ESCAPING); }
public NodeInfo mapItem(NodeInfo item) { if (Navigator.isAncestorOrSelf(origin, item)) { return item; } else { return null; } }
/** * On completion, get the assembled JSON string * * @return the JSON string representing the supplied XML content. */ public String getJsonString() { return output.toString(); }
public boolean hasNext() { if (element == null || (next == null && index != 0)) { return false; } advance(); return next != null; }
/** * Append an integer, formatted as two digits, to a string buffer * * @param sb the string buffer * @param value the integer to be formatted (must be in the range 0..99 */ static void appendTwoDigits(/*@NotNull*/ FastStringBuffer sb, int value) { sb.append((char) (value / 10 + '0')); sb.append((char) (value % 10 + '0')); }
/** * Append a character to the buffer * * @param ch the character to be added */ public void append(char ch) { ensureCapacity(1); array[used++] = ch; }
public N next() { if (current == null) { // implies includeSelf: first time round, return the start node current = start; return start; } N curr = stepper.step(current); return current = curr; }
/** * Get the index of an attribute (by name). * * @param uri The namespace uri of the attribute. * @param localname The local name of the attribute. * @return The index position of the attribute, or -1 if absent */ public int getIndex(String uri, String localname) { return findByName(uri, localname); }
/** * Ask whether the attribute collection contains any attributes * in a specified namespace * * @param uri the specified namespace * @return true if there are one or more attributes in this namespace */ public boolean hasAttributeInNamespace(String uri) { return bufferedAttributes.hasAttributeInNamespace(uri); }
public N step(N node) { do { node = getFollowingNode(node, anchor); } while (node != null && node.getFingerprint() != fingerprint); return node; } }
/** * Ask whether this node has the is-idref property * * @return true if the node is an IDREF or IDREFS element or attribute */ public boolean isIdref() { return isOption(ReceiverOptions.IS_IDREF); }
/** * Ask whether a node in the source tree is within the scope of this virtual copy * @param sourceNode the node being tested * @return true if the node is within the scope of the subtree */ protected boolean isIncludedInCopy(NodeInfo sourceNode) { return Navigator.isAncestorOrSelf(root, sourceNode); }