/** * Returns an iterator over the in-scope namespace bindings of the element. * * @return an Iterator. */ @Override public Iterator<NamespaceBinding> iterator() { return NamespaceIterator.iterateNamespaces(element); } }
/** * 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 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"); } }; }
/** * 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"); } }; }
return new Iterator<String>() { int phase = 0; Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(node);
final Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(element); return new UnfailingIterator<StringValue>() { private int position = 0;
return new Iterator<String>() { int phase = 0; Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(node);
final Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(element); return new UnfailingIterator<StringValue>() { private int position = 0;
/** * Make a NamespaceContext object representing the list of in-scope namespaces. This will * be a copy of the namespace context with no references to objects in the stylesheet tree, * so that it can be kept until run-time without locking the tree down in memory. * * @return a copy of the namespace context */ public SavedNamespaceContext makeNamespaceContext() { return new SavedNamespaceContext(NamespaceIterator.iterateNamespaces(this)); }
/** * Make a NamespaceContext object representing the list of in-scope namespaces. This will * be a copy of the namespace context with no references to objects in the stylesheet tree, * so that it can be kept until run-time without locking the tree down in memory. * * @return a copy of the namespace context */ public SavedNamespaceContext makeNamespaceContext() { StylesheetPackage pack = getPackageData(); return new SavedNamespaceContext(NamespaceIterator.iterateNamespaces(this)); }
/** * Get the namespace URI corresponding to a given prefix. Return null * if the prefix is not in scope. * * @param prefix the namespace prefix. May be the zero-length string, indicating * that there is no prefix. This indicates either the default namespace or the * null namespace, depending on the value of useDefault. * @param useDefault true if the default namespace is to be used when the * prefix is "". If false, the method returns "" when the prefix is "". * @return the uri for the namespace, or null if the prefix is not in scope. * The "null namespace" is represented by the pseudo-URI "". */ /*@Nullable*/ public String getURIForPrefix(String prefix, boolean useDefault) { if (prefix.isEmpty() && !useDefault) { return NamespaceConstant.NULL; } if (prefix.equals("xml")) { return NamespaceConstant.XML; } Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(node); while (iter.hasNext()) { NamespaceBinding nb = iter.next(); if (nb.getPrefix().equals(prefix)) { return nb.getURI(); } } return prefix.isEmpty() ? "" : null; }
/** * Get the namespace URI corresponding to a given prefix. Return null * if the prefix is not in scope. * * @param prefix the namespace prefix. May be the zero-length string, indicating * that there is no prefix. This indicates either the default namespace or the * null namespace, depending on the value of useDefault. * @param useDefault true if the default namespace is to be used when the * prefix is "". If false, the method returns "" when the prefix is "". * @return the uri for the namespace, or null if the prefix is not in scope. * The "null namespace" is represented by the pseudo-URI "". */ /*@Nullable*/ public String getURIForPrefix(String prefix, boolean useDefault) { if (prefix.isEmpty() && !useDefault) { return NamespaceConstant.NULL; } if (prefix.equals("xml")) { return NamespaceConstant.XML; } Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(node); while (iter.hasNext()) { NamespaceBinding nb = iter.next(); if (nb.getPrefix().equals(prefix)) { return nb.getURI(); } } return prefix.isEmpty() ? "" : null; }
/** * Factory method to create an iterator over the in-scope namespace nodes of an element * * @param element the node whose namespaces are required * @param test used to filter the returned nodes * @return an iterator over the namespace nodes that satisfy the test */ /*@NotNull*/ public static AxisIterator makeIterator(final NodeInfo element, /*@NotNull*/ NodeTest test) { List<NodeInfo> nodes = new ArrayList<>(); Iterator<NamespaceBinding> bindings = NamespaceIterator.iterateNamespaces(element); int position = 0; while (bindings.hasNext()) { NamespaceNode node = new NamespaceNode(element, bindings.next(), position++); if (test.matchesNode(node)) { nodes.add(node); } } NamespaceNode node = new NamespaceNode(element, NamespaceBinding.XML, position); if (test.matchesNode(node)) { nodes.add(node); } return new ListIterator.OfNodes(nodes); } }
/** * Factory method to create an iterator over the in-scope namespace nodes of an element * * @param element the node whose namespaces are required * @param test used to filter the returned nodes * @return an iterator over the namespace nodes that satisfy the test */ /*@NotNull*/ public static AxisIterator makeIterator(final NodeInfo element, /*@NotNull*/ NodeTest test) { List<NodeInfo> nodes = new ArrayList<>(); Iterator<NamespaceBinding> bindings = NamespaceIterator.iterateNamespaces(element); int position = 0; while (bindings.hasNext()) { NamespaceNode node = new NamespaceNode(element, bindings.next(), position++); if (test.matchesNode(node)) { nodes.add(node); } } NamespaceNode node = new NamespaceNode(element, NamespaceBinding.XML, position); if (test.matchesNode(node)) { nodes.add(node); } return new ListIterator.OfNodes(nodes); } }
if (ext != null) { if ("#all".equals(Whitespace.trim(ext))) { Iterator<NamespaceBinding> codes = NamespaceIterator.iterateNamespaces(this); List<String> excluded = new ArrayList<>(); while (codes.hasNext()) {
if (ext != null) { if ("#all".equals(Whitespace.trim(ext))) { Iterator<NamespaceBinding> codes = NamespaceIterator.iterateNamespaces(this); List<String> excluded = new ArrayList<>(); while (codes.hasNext()) {
} else { int count = 0; Iterator<NamespaceBinding> nsiter = NamespaceIterator.iterateNamespaces(inode); while (nsiter.hasNext()) { count++; nsiter = NamespaceIterator.iterateNamespaces(inode); count = 0; while (nsiter.hasNext()) {
} else { int count = 0; Iterator<NamespaceBinding> nsiter = NamespaceIterator.iterateNamespaces(inode); while (nsiter.hasNext()) { count++; nsiter = NamespaceIterator.iterateNamespaces(inode); count = 0; while (nsiter.hasNext()) {
} else { List<NamespaceBinding> allNamespaces = new ArrayList<>(20); Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(original); while (iter.hasNext()) { allNamespaces.add(iter.next());
if (original == root) { List<NamespaceBinding> bindings = new ArrayList<>(); Iterator<NamespaceBinding> iter = NamespaceIterator.iterateNamespaces(original); boolean declaresDefaultNamespace = false; while (iter.hasNext()) {