Package net.sf.saxon.s9api

## Interface Push.Document

- All Superinterfaces:
    `Push.Container`
  Enclosing interface:
    Push

      public static interface Push.Document
      extends Push.Container

  A `Push.Container` representing a document node.

  If the document is constrained to be well-formed then the permitted sequence of events is `(COMMENT | PI)* ELEMENT (COMMENT | PI)* CLOSE`.

  If the document is NOT constrained to be well-formed then the permitted sequence of events is `(COMMENT | PI | TEXT | ELEMENT)* CLOSE`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Push.Document` | `comment​(java.lang.CharSequence value)` | Add a comment node to the current element or document node.
    `Push.Document` | `processingInstruction​(java.lang.String name, java.lang.CharSequence value)` | Add a processing instruction node to the current element or document node.
    `Push.Document` | `text​(java.lang.CharSequence value)` | Add text content to the current element node (or, in the case of a non-well-formed document, as a child of the document node).

    - ### Methods inherited from interface net.sf.saxon.s9api.Push.Container

      `close, element, element, setDefaultNamespace`

- - ### Method Detail

    - #### text

          Push.Document text​(java.lang.CharSequence value)
                      throws SaxonApiException

      Description copied from interface: `Push.Container`
      Add text content to the current element node (or, in the case of a non-well-formed document, as a child of the document node).

      Multiple consecutive calls on `text()` generate a single text node with concatenated content: that is, `text("one).text("two")` is equivalent to `text("onetwo")`.

      Specified by:
        `text` in interface `Push.Container`
      Parameters:
        `value` - the content of the text node. Supplying a zero-length string or null is permitted, but has no effect.
      Returns:
        the Container to which the method is applied. This is to allow chained method calls, of the form `tag.element("a").text("content").close()`
      Throws:
        `SaxonApiException` - if the specified constraints are violated, or if the implementation detects any problems

    - #### comment

          Push.Document comment​(java.lang.CharSequence value)
                         throws SaxonApiException

      Description copied from interface: `Push.Container`
      Add a comment node to the current element or document node.

      The method call is allowed in states `START_TAG`, `CONTENT`, and `NON_TEXT_CONTENT`, and it sets the state to `CONTENT`.

      Specified by:
        `comment` in interface `Push.Container`
      Parameters:
        `value` - the content of the comment node. The value should not contain the string "--"; it is implementation-defined whether this causes an exception, or whether some recovery action is taken such as replacing the string by "- -". If the value is null, no comment node is written.
      Returns:
        the Container to which the method is applied. This is to allow chained method calls, of the form `tag.element("a").comment("optional").close()`
      Throws:
        `SaxonApiException` - if the specified constraints are violated, or if the implementation detects any problems

    - #### processingInstruction

          Push.Document processingInstruction​(java.lang.String name,
                                              java.lang.CharSequence value)
                                       throws SaxonApiException

      Description copied from interface: `Push.Container`
      Add a processing instruction node to the current element or document node.

      The method call is allowed in states `START_TAG`, `CONTENT`, and `NON_TEXT_CONTENT`, and it sets the state to `CONTENT`.

      Specified by:
        `processingInstruction` in interface `Push.Container`
      Parameters:
        `name` - the name ("target") of the processing instruction. The level of validation applied to the supplied name is implementation-defined. Must not be null.
        `value` - the content ("data") of the processing instruction node. The value should not contain the string `"?>"`; it is implementation-defined whether this causes an exception, or whether some recovery action is taken such as replacing the string by `"? >"`. If the value is null, no processing instruction node is written.
      Returns:
        the Container to which the method is applied. This is to allow chained method calls, of the form `tag.element("a").processing-instruction("target", "data").close()`
      Throws:
        `SaxonApiException` - if the specified constraints are violated, or if the implementation detects any problems