Package net.sf.saxon.s9api

## Class BuildingStreamWriterImpl

- java.lang.Object
- - net.sf.saxon.event.StreamWriterToReceiver
  - - net.sf.saxon.s9api.BuildingStreamWriterImpl

- All Implemented Interfaces:
    `javax.xml.stream.XMLStreamWriter`, `BuildingStreamWriter`

      public class BuildingStreamWriterImpl
      extends StreamWriterToReceiver
      implements BuildingStreamWriter

  This class is an implementation of `XMLStreamWriter`, allowing a document to be constructed by means of a series of XMLStreamWriter method calls such as writeStartElement(), writeAttribute(), writeCharacters(), and writeEndElement().

  The detailed way in which this class is packaged was carefully designed to ensure that if the functionality is not used, the `DocumentBuilder` would still be usable under JDK 1.5 (which does not include javax.xml.stream interfaces).

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BuildingStreamWriterImpl​(Receiver receiver, Builder builder)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `XdmNode` | `getDocumentNode()` | After building the document by writing a sequence of events, retrieve the root node of the constructed document tree

    - ### Methods inherited from class net.sf.saxon.event.StreamWriterToReceiver

      `close, flush, getNamespaceContext, getPrefix, getProperty, getReceiver, isCheckValues, setCheckValues, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEndElement, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement, writeStartElement, writeStartElement`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.s9api.BuildingStreamWriter

      `isCheckValues, setCheckValues`

    - ### Methods inherited from interface javax.xml.stream.XMLStreamWriter

      `close, flush, getNamespaceContext, getPrefix, getProperty, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEndElement, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement, writeStartElement, writeStartElement`

- - ### Constructor Detail

    - #### BuildingStreamWriterImpl

          public BuildingStreamWriterImpl​(Receiver receiver,
                                          Builder builder)

  - ### Method Detail

    - #### getDocumentNode

          public XdmNode getDocumentNode()
                                  throws SaxonApiException

      Description copied from interface: `BuildingStreamWriter`
      After building the document by writing a sequence of events, retrieve the root node of the constructed document tree
      Specified by:
        `getDocumentNode` in interface `BuildingStreamWriter`
      Returns:
        the root node of the constructed tree. The result is undefined (maybe null, maybe an exception) if the method is called before successfully completing the sequence of events (of which the last should be `XMLStreamWriter.writeEndDocument()`) that constructs the tree.
      Throws:
        `SaxonApiException` - if any failure occurs