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;
}
Aggregations