| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.om; |
| 9 | |
| 10 | import net.sf.saxon.tree.util.NamespaceIterator; |
| 11 | |
| 12 | import java.util.Iterator; |
| 13 | |
| 14 | /** |
| 15 | * Represents the set of all namespace bindings that are in scope for a particular element node |
| 16 | */ |
| 17 | public class InScopeNamespaces implements NamespaceBindingSet { |
| 18 | |
| 19 | private NodeInfo element; |
| 20 | |
| 21 | public InScopeNamespaces(NodeInfo element) { |
| 22 | this.element = element; |
| 23 | } |
| 24 | |
| 25 | public NodeInfo getElement() { |
| 26 | return element; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Returns an iterator over the in-scope namespace bindings of the element. |
| 31 | * |
| 32 | * @return an Iterator. |
| 33 | */ |
| 34 | @Override |
| 35 | public Iterator<NamespaceBinding> iterator() { |
| 36 | return NamespaceIterator.iterateNamespaces(element); |
| 37 | } |
| 38 | } |
| 39 |