net.sf.saxon.s9api

## Interface BuildingStreamWriter

- All Superinterfaces:
    XMLStreamWriter
  All Known Implementing Classes:
    BuildingStreamWriterImpl

      public interface BuildingStreamWriter
      extends XMLStreamWriter

  A BuildingStreamWriter allows a document to be constructed by calling the methods defined in the `XMLStreamWriter` interface; after the document has been constructed, its root node may be retrieved by calling the `getDocumentNode()` method.

  The class will attempt to generate namespace prefixes where none have been supplied, unless the `inventPrefixes` option is set to false. The preferred mode of use is to call the versions of `writeStartElement` and `writeAttribute` that supply the prefix, URI, and local name in full. If the prefix is omitted, the class attempts to invent a prefix. If the URI is omitted, the name is assumed to be in no namespace. The `writeNamespace`

  method should be called only if there is a need to declare a namespace prefix that is not used on any element or attribute name.

  The class will check all names, URIs, and character content for conformance against XML well-formedness rules unless the `checkValues` option is set to false.

  A `BuildingStreamWriter` for a particular object model can be obtained by calling `DocumentBuilder.newBuildingStreamWriter()`.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `XdmNode` | `getDocumentNode()` After building the document by writing a sequence of events, retrieve the root node of the constructed document tree
    `boolean` | `isCheckValues()` Ask whether names and values are to be checked for conformance with XML rules
    `boolean` | `isInventPrefixes()` Ask whether prefixes are to be invented when none is specified by the user
    `void` | `setCheckValues(boolean check)` Say whether names and values are to be checked for conformance with XML rules
    `void` | `setInventPrefixes(boolean invent)` Say whether prefixes are to be invented when none is specified by the user

    - ### 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`

- - ### Method Detail

    - #### getDocumentNode

          XdmNode getDocumentNode()
                                  throws SaxonApiException

      After building the document by writing a sequence of events, retrieve the root node of the constructed document tree
      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

    - #### setInventPrefixes

          void setInventPrefixes(boolean invent)

      Say whether prefixes are to be invented when none is specified by the user
      Parameters:
        `invent` - true if prefixes are to be invented. Default is true.

    - #### isInventPrefixes

          boolean isInventPrefixes()

      Ask whether prefixes are to be invented when none is specified by the user
      Returns:
        true if prefixes are to be invented. Default is true.

    - #### setCheckValues

          void setCheckValues(boolean check)

      Say whether names and values are to be checked for conformance with XML rules
      Parameters:
        `check` - true if names and values are to be checked. Default is true.

    - #### isCheckValues

          boolean isCheckValues()

      Ask whether names and values are to be checked for conformance with XML rules
      Returns:
        true if names and values are to be checked. Default is true.

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.