Debian Codegraph @

net/sf/saxon/om/DocumentInfo.java

raw symbols SCIP
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.event.Receiver;
11 import net.sf.saxon.expr.parser.Location;
12 import net.sf.saxon.trans.XPathException;
13 import net.sf.saxon.tree.iter.AxisIterator;
14 import net.sf.saxon.tree.wrapper.AbstractVirtualNode;
15 import net.sf.saxon.type.Type;
16
17 import javax.xml.transform.Source;
18
19 /**
20 * The class DocumentInfo is retained in Saxon 9.7 to preserve a level of backwards compatibility
21 * for applications that use the method {@link net.sf.saxon.Configuration#buildDocument(Source)}
22 * method to construct a tree. In earlier releases it was an interface implemented by all document
23 * nodes; from 9.7 it is a wrapper object around the NodeInfo object that represents the actual
24 * document node
25 */
26 public class DocumentInfo extends AbstractVirtualNode {
27
28 public DocumentInfo(NodeInfo node) {
29 if (node.getNodeKind() != Type.DOCUMENT) {
30 throw new IllegalArgumentException("DocumentInfo must only be used for document nodes");
31 }
32 this.node = node;
33 this.parent = null;
34 this.docWrapper = node.getTreeInfo();
35 }
36
37 @Override
38 public void copy(Receiver out, int copyOptions, Location locationId) throws XPathException {
39 node.copy(out, copyOptions, locationId);
40 }
41
42 @Override
43 public NodeInfo getParent() {
44 return null;
45 }
46
47 @Override
48 public AxisIterator iterateAxis(byte axisNumber) {
49 return node.iterateAxis(axisNumber);
50 }
51 }
52