public XdmNode getDocumentNode() { return new XdmNode(builder.getCurrentRoot()); } }
public XdmNode getDocumentNode() throws SaxonApiException { return new XdmNode(builder.getCurrentRoot()); } }
/** * Return the node at the root of the tree, after it has been constructed. * <p>This method should not be called while the tree is under construction.</p> * * @return the root node of the tree (always a document or element node); or null if * nothing is written to the tree (for example, the result of a query that returns the * empty sequence) * @throws IllegalStateException if called during the execution of the process that * is writing the tree. */ public XdmNode getXdmNode() { if (builder == null) { throw new IllegalStateException("The document has not yet been built"); } NodeInfo node = builder.getCurrentRoot(); return node == null ? null : (XdmNode) XdmValue.wrap(node); }
/** * Return the node at the root of the tree, after it has been constructed. * <p>This method should not be called while the tree is under construction.</p> * * @return the root node of the tree (always a document or element node); or null if * nothing is written to the tree (for example, the result of a query that returns the * empty sequence) * @throws IllegalStateException if called during the execution of the process that * is writing the tree. */ public XdmNode getXdmNode() { if (builder == null) { throw new IllegalStateException("The document has not yet been built"); } NodeInfo node = builder.getCurrentRoot(); return node == null ? null : (XdmNode) XdmValue.wrap(node); }
/** * Return the complete parsed result * * @return the XML document for this JSON * @throws XPathException */ public Item getResult() throws XPathException { out.endDocument(); out.close(); return builder.getCurrentRoot(); }
@Override public void endDocument() throws XPathException { if (--level == 0) { outputter.endDocument(); outputter = null; NodeInfo doc = builder.getCurrentRoot(); // add the constructed document to the result sequence append(doc, ExplicitLocation.UNKNOWN_LOCATION, ReceiverOptions.ALL_NAMESPACES); systemId = null; } previousAtomic = false; }
/** * Notify the end of a document node */ public void endDocument() throws XPathException { if (--level == 0) { outputter.endDocument(); DocumentInfo doc = (DocumentInfo)builder.getCurrentRoot(); // add the constructed document to the result sequence append(doc, 0, NodeInfo.ALL_NAMESPACES); } previousAtomic = false; }
@Override public void endDocument() throws XPathException { if (--level == 0) { outputter.endDocument(); outputter = null; NodeInfo doc = builder.getCurrentRoot(); // add the constructed document to the result sequence append(doc, ExplicitLocation.UNKNOWN_LOCATION, ReceiverOptions.ALL_NAMESPACES); } previousAtomic = false; }
/** * Return the complete parsed result * * @return the XML document for this JSON * @throws XPathException */ public Item getResult() throws XPathException { out.endDocument(); out.close(); return builder.getCurrentRoot(); }
public XdmNode getDocumentNode() throws SaxonApiException { try { builder.close(); } catch (XPathException e) { throw new SaxonApiException(e); } return new XdmNode(builder.getCurrentRoot()); } }
public XdmNode getDocumentNode() throws SaxonApiException { try { builder.close(); } catch (XPathException e) { throw new SaxonApiException(e); } return new XdmNode(builder.getCurrentRoot()); } }
/** * Override the behaviour of endDocument() in ReceivingContentHandler, so that it fires off * the transformation of the constructed document */ public void endDocument() throws SAXException { super.endDocument(); DocumentInfo doc = (DocumentInfo)builder.getCurrentRoot(); builder.reset(); if (doc==null) { throw new SAXException("No source document has been built"); } try { controller.transformDocument(doc, result); } catch (TransformerException err) { if (err instanceof XPathException) { controller.reportFatalError((XPathException)err); } throw new SAXException(err); } }
/** * Output an element end tag. */ public void endElement() throws XPathException { if (inStartTag) { startContent(); } outputter.endElement(); if (--level == 0) { outputter.close(); NodeInfo element = builder.getCurrentRoot(); append(element, 0, NodeInfo.ALL_NAMESPACES); } previousAtomic = false; }
/** * Copy a DOM node to create a node in a different tree model * * @param node the DOM node to be copied * @param model the target tree model * @param config the Saxon Configuration * @return the copied node * @throws net.sf.saxon.trans.XPathException * if the operation fails * @since 9.2 */ public NodeInfo copy(Node node, TreeModel model, Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); Builder builder = model.makeBuilder(pipe); builder.open(); Sender.send(new DOMSource(node), builder, null); NodeInfo result = builder.getCurrentRoot(); builder.close(); return result; }
@Override public void endElement() throws XPathException { if (inStartTag) { startContent(); } //System.err.println("SEQUENCE_WRITER endElement " + this); outputter.endElement(); if (--level == 0) { outputter.close(); outputter = null; NodeInfo element = builder.getCurrentRoot(); append(element, ExplicitLocation.UNKNOWN_LOCATION, ReceiverOptions.ALL_NAMESPACES); systemId = null; } previousAtomic = false; }
@Override public void endElement() throws XPathException { if (inStartTag) { startContent(); } //System.err.println("SEQUENCE_WRITER endElement " + this); outputter.endElement(); if (--level == 0) { outputter.close(); outputter = null; NodeInfo element = builder.getCurrentRoot(); append(element, ExplicitLocation.UNKNOWN_LOCATION, ReceiverOptions.ALL_NAMESPACES); } previousAtomic = false; }
/** * Override the behaviour of endDocument() in ProxyReceiver, so that it fires off * the transformation of the constructed document */ public void close() throws XPathException { nextReceiver.close(); DocumentInfo doc = (DocumentInfo)builder.getCurrentRoot(); if (doc==null) { throw new XPathException("No source document has been built"); } //doc.getNamePool().allocateDocumentNumber(doc); try { controller.transformDocument(doc, result); } catch (TransformerException e) { throw XPathException.makeXPathException(e); } }
/** * Override the behaviour of endDocument() in ProxyReceiver, so that it fires off * the transformation of the constructed document */ public void close() throws XPathException { nextReceiver.close(); DocumentInfo doc = (DocumentInfo)builder.getCurrentRoot(); if (doc==null) { throw new XPathException("No source document has been built"); } //doc.getNamePool().allocateDocumentNumber(doc); try { controller.transformDocument(doc, result); } catch (TransformerException e) { throw XPathException.makeXPathException(e); } }
/** * Override the behaviour of endDocument() in ReceivingContentHandler, so that it fires off * the transformation of the constructed document */ public void endDocument() throws SAXException { super.endDocument(); NodeInfo doc = builder.getCurrentRoot(); doc.getTreeInfo().setSpaceStrippingRule( transformer.getUnderlyingXsltTransformer().getUnderlyingController().getSpaceStrippingRule()); builder.reset(); if (doc == null) { throw new SAXException("No source document has been built"); } try { transformer.transform(doc, result); } catch (TransformerException err) { throw new SAXException(err); } }
/** * Override the behaviour of endDocument() in ReceivingContentHandler, so that it fires off * the transformation of the constructed document */ public void endDocument() throws SAXException { super.endDocument(); NodeInfo doc = builder.getCurrentRoot(); doc.getTreeInfo().setSpaceStrippingRule( transformer.getUnderlyingXsltTransformer().getUnderlyingController().getSpaceStrippingRule()); builder.reset(); if (doc == null) { throw new SAXException("No source document has been built"); } try { transformer.transform(doc, result); } catch (TransformerException err) { throw new SAXException(err); } }