| 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.tree.wrapper; |
| 9 | |
| 10 | import net.sf.saxon.om.NodeInfo; |
| 11 | |
| 12 | /** |
| 13 | * This interface is implemented by NodeInfo implementations that act as wrappers |
| 14 | * on some underlying tree. It provides a method to access the real node underlying |
| 15 | * the virtual node, for use by applications that need to drill down to the |
| 16 | * underlying data. |
| 17 | */ |
| 18 | |
| 19 | public interface VirtualNode extends NodeInfo { |
| 20 | |
| 21 | /** |
| 22 | * Get the node underlying this virtual node. Note that this may itself be |
| 23 | * a VirtualNode; you may have to drill down through several layers of |
| 24 | * wrapping. |
| 25 | * <p>In some cases a single VirtualNode may represent an XPath text node that maps to a sequence |
| 26 | * of adjacent nodes (for example text nodes and CDATA nodes) in the underlying tree. In this case |
| 27 | * the first node in this sequence is returned.</p> |
| 28 | * |
| 29 | * @return The underlying node. |
| 30 | */ |
| 31 | |
| 32 | Object getUnderlyingNode(); |
| 33 | |
| 34 | /** |
| 35 | * Get the node underlying this virtual node. If this is a VirtualNode the method |
| 36 | * will automatically drill down through several layers of wrapping. |
| 37 | * <p>In some cases a single VirtualNode may represent an XPath text node that maps to a sequence |
| 38 | * of adjacent nodes (for example text nodes and CDATA nodes) in the underlying tree. In this case |
| 39 | * the first node in this sequence is returned.</p> |
| 40 | * |
| 41 | * @return The underlying node. |
| 42 | */ |
| 43 | |
| 44 | Object getRealNode(); |
| 45 | |
| 46 | } |
| 47 |