Search in sources :

Example 1 with InMemoryXMLStreamReader

use of org.exist.dom.memtree.InMemoryXMLStreamReader in project exist by eXist-db.

the class XQueryContext method getXMLStreamReader.

@Override
public ExtendedXMLStreamReader getXMLStreamReader(final NodeValue nv) throws XMLStreamException, IOException {
    final ExtendedXMLStreamReader reader;
    if (nv.getImplementationType() == NodeValue.IN_MEMORY_NODE) {
        final NodeImpl node = (NodeImpl) nv;
        final org.exist.dom.memtree.DocumentImpl ownerDoc = node.getNodeType() == Node.DOCUMENT_NODE ? (org.exist.dom.memtree.DocumentImpl) node : node.getOwnerDocument();
        reader = new InMemoryXMLStreamReader(ownerDoc, ownerDoc);
    } else {
        final NodeProxy proxy = (NodeProxy) nv;
        reader = getBroker().newXMLStreamReader(new NodeProxy(proxy.getOwnerDocument(), NodeId.DOCUMENT_NODE, proxy.getOwnerDocument().getFirstChildAddress()), false);
    }
    return reader;
}
Also used : ExtendedXMLStreamReader(org.exist.stax.ExtendedXMLStreamReader) NodeImpl(org.exist.dom.memtree.NodeImpl) InMemoryXMLStreamReader(org.exist.dom.memtree.InMemoryXMLStreamReader)

Aggregations

InMemoryXMLStreamReader (org.exist.dom.memtree.InMemoryXMLStreamReader)1 NodeImpl (org.exist.dom.memtree.NodeImpl)1 ExtendedXMLStreamReader (org.exist.stax.ExtendedXMLStreamReader)1