All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.saxon.om.DocumentInfo Maven / Gradle / Ivy

package net.sf.saxon.om;

import net.sf.saxon.event.Receiver;
import net.sf.saxon.expr.parser.Location;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.tree.iter.AxisIterator;
import net.sf.saxon.tree.wrapper.AbstractVirtualNode;
import net.sf.saxon.type.Type;

import javax.xml.transform.Source;

/**
 * The class DocumentInfo is retained in Saxon 9.7 to preserve a level of backwards compatibility
 * for applications that use the method {@link net.sf.saxon.Configuration#buildDocument(Source)}
 * method to construct a tree. In earlier releases it was an interface implemented by all document
 * nodes; from 9.7 it is a wrapper object around the NodeInfo object that represents the actual
 * document node
 */
public class DocumentInfo extends AbstractVirtualNode {

    public DocumentInfo(NodeInfo node) {
        if (node.getNodeKind() != Type.DOCUMENT) {
            throw new IllegalArgumentException("DocumentInfo must only be used for document nodes");
        }
        this.node = node;
        this.parent = null;
        this.docWrapper = node.getTreeInfo();
    }

    @Override
    public void copy(Receiver out, int copyOptions, Location locationId) throws XPathException {
        node.copy(out, copyOptions, locationId);
    }

    @Override
    public NodeInfo getParent() {
        return null;
    }

    @Override
    public AxisIterator iterateAxis(byte axisNumber) {
        return node.iterateAxis(axisNumber);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy