/** * Returns an iterator over the in-scope namespace bindings of the element. * * @return an Iterator. */ @Override public Iterator<NamespaceBinding> iterator() { return NamespaceIterator.iterateNamespaces(element); } }
/** * Factory method: create an iterator over the in-scope namespace codes for an element * * @param element the element (or other node) whose in-scope namespaces are required. If this * is not an element, the result will be an empty iterator * @return an iterator over the namespace codes. A namespace code is an integer that represents * a prefix-uri binding; the prefix and URI can be obtained by reference to the name pool. This * iterator will represent all the in-scope namespaces, without duplicates, and respecting namespace * undeclarations. It does not include the XML namespace. */ public static Iterator<NamespaceBinding> iterateNamespaces(/*@NotNull*/ NodeInfo element) { if (element.getNodeKind() == Type.ELEMENT) { return new NamespaceIterator(element); } else { List<NamespaceBinding> e = Collections.emptyList(); return e.iterator(); } }
public boolean hasNext() { if (element == null || (next == null && index != 0)) { return false; } advance(); return next != null; }
/** * Callback to output namespace nodes for the new element. * * @param context The execution context * @param receiver the Receiver where the namespace nodes are to be written * @param nodeName the element name * @param copiedNode the node being copied (for xsl:copy), otherwise null * @throws XPathException */ public void outputNamespaceNodes(XPathContext context, Receiver receiver, NodeName nodeName, NodeInfo copiedNode) throws XPathException { if (copyNamespaces) { NamespaceIterator.sendNamespaces(copiedNode, receiver); } else { // Always output the namespace of the element name itself receiver.namespace(nodeName.getNamespaceBinding(), 0); } }
/** * Callback to output namespace nodes for the new element. * * @param context The execution context * @param receiver the Receiver where the namespace nodes are to be written * @param nodeName the element name * @param copiedNode the node being copied (for xsl:copy), otherwise null * @throws XPathException */ public void outputNamespaceNodes(XPathContext context, Receiver receiver, NodeName nodeName, NodeInfo copiedNode) throws XPathException { if (copyNamespaces) { NamespaceIterator.sendNamespaces(copiedNode, receiver); } else { // Always output the namespace of the element name itself receiver.namespace(nodeName.getNamespaceBinding(), 0); } }
/** * Returns an iterator over the in-scope namespace bindings of the element. * * @return an Iterator. */ @Override public Iterator<NamespaceBinding> iterator() { return NamespaceIterator.iterateNamespaces(element); } }
if ((copyOptions & CopyOptions.ALL_NAMESPACES) != 0) { NamespaceIterator.sendNamespaces(this, receiver);
public boolean hasNext() { if (element == null || (next == null && index != 0)) { return false; } advance(); return next != null; }
/** * Factory method: create an iterator over the in-scope namespace codes for an element * * @param element the element (or other node) whose in-scope namespaces are required. If this * is not an element, the result will be an empty iterator * @return an iterator over the namespace codes. A namespace code is an integer that represents * a prefix-uri binding; the prefix and URI can be obtained by reference to the name pool. This * iterator will represent all the in-scope namespaces, without duplicates, and respecting namespace * undeclarations. It does not include the XML namespace. */ public static Iterator<NamespaceBinding> iterateNamespaces(/*@NotNull*/ NodeInfo element) { if (element.getNodeKind() == Type.ELEMENT) { return new NamespaceIterator(element); } else { List<NamespaceBinding> e = Collections.emptyList(); return e.iterator(); } }
/** * Get an iterator over all the prefixes declared in this namespace context. This will include * the default namespace (prefix="") and the XML namespace where appropriate */ /*@Nullable*/ public Iterator<String> iteratePrefixes() { return new Iterator<String>() { /*@Nullable*/ private NamePool pool = null; private Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(ElementImpl.this); public boolean hasNext() { return pool == null || iter.hasNext(); } public String next() { if (pool == null) { pool = getNamePool(); return "xml"; } else { return iter.next().getPrefix(); } } public void remove() { throw new UnsupportedOperationException("remove"); } }; }
if ((copyOptions & CopyOptions.ALL_NAMESPACES) != 0) { NamespaceIterator.sendNamespaces(this, receiver);
/** * Get an iterator over all the prefixes declared in this namespace context. This will include * the default namespace (prefix="") and the XML namespace where appropriate */ /*@Nullable*/ public Iterator<String> iteratePrefixes() { return new Iterator<String>() { /*@Nullable*/ private NamePool pool = null; private Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(ElementImpl.this); public boolean hasNext() { return pool == null || iter.hasNext(); } public String next() { if (pool == null) { pool = getNamePool(); return "xml"; } else { return iter.next().getPrefix(); } } public void remove() { throw new UnsupportedOperationException("remove"); } }; }
NamespaceIterator.sendNamespaces(this, out); childCopyOptions |= CopyOptions.LOCAL_NAMESPACES;
return new Iterator<String>() { int phase = 0; Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(node);
NamespaceIterator.sendNamespaces(this, out); childCopyOptions |= CopyOptions.LOCAL_NAMESPACES;
final Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(element); return new UnfailingIterator<StringValue>() { private int position = 0;
NamespaceIterator.sendNamespaces(this, receiver);
return new Iterator<String>() { int phase = 0; Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(node);
NamespaceIterator.sendNamespaces(node, out);
final Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(element); return new UnfailingIterator<StringValue>() { private int position = 0;