| 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.s9api; |
| 9 | |
| 10 | import org.xml.sax.ContentHandler; |
| 11 | |
| 12 | /** |
| 13 | * A SAX {@link ContentHandler} that builds a Saxon tree, and allows the node at the root of the tree |
| 14 | * to be retrieved on completion. |
| 15 | * <p>To create a <code>BuildingContentHandler</code> for a particular tree model, use the method |
| 16 | * {@link net.sf.saxon.s9api.DocumentBuilder#newBuildingContentHandler()}.</p> |
| 17 | */ |
| 18 | public interface BuildingContentHandler extends ContentHandler { |
| 19 | |
| 20 | /** |
| 21 | * After building the document by writing a sequence of events, retrieve the root node |
| 22 | * of the constructed document tree |
| 23 | * |
| 24 | * @return the root node of the constructed tree. The result is undefined (maybe null, maybe an exception) |
| 25 | * if the method is called before successfully completing the sequence of events (of which the last should be |
| 26 | * {@link #endDocument}) that constructs the tree. |
| 27 | * @throws SaxonApiException if any failure occurs |
| 28 | */ |
| 29 | |
| 30 | public XdmNode getDocumentNode() throws SaxonApiException; |
| 31 | |
| 32 | } |
| 33 |