org.apache.synapse.commons.staxon.core.base

## Class AbstractXMLStreamWriter<T>

- java.lang.Object
- - org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamWriter<T>

- All Implemented Interfaces:
    javax.xml.stream.XMLStreamWriter
  Direct Known Subclasses:
    JsonXMLStreamWriter

      public abstract class AbstractXMLStreamWriter<T>
      extends java.lang.Object
      implements javax.xml.stream.XMLStreamWriter

  Abstract XML stream writer.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractXMLStreamWriter(T rootInfo, boolean repaireNamespaces)` Create writer instance.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `javax.xml.namespace.NamespaceContext` | `getNamespaceContext()`
    `java.lang.String` | `getPrefix(java.lang.String namespaceURI)`
    `java.lang.Object` | `getProperty(java.lang.String name)`
    `protected XMLStreamWriterScope<T>` | `getScope()`
    `protected boolean` | `isStartDocumentWritten()`
    `void` | `setDefaultNamespace(java.lang.String namespaceURI)`
    `void` | `setNamespaceContext(javax.xml.namespace.NamespaceContext context)`
    `void` | `setPrefix(java.lang.String prefix, java.lang.String namespaceURI)`
    `protected abstract void` | `writeAttr(java.lang.String prefix, java.lang.String localName, java.lang.String namespaceURI, java.lang.String value)` Write attribute.
    `void` | `writeAttribute(java.lang.String localName, java.lang.String value)`
    `void` | `writeAttribute(java.lang.String namespaceURI, java.lang.String localName, java.lang.String value)`
    `void` | `writeAttribute(java.lang.String prefix, java.lang.String namespaceURI, java.lang.String localName, java.lang.String value)`
    `void` | `writeCData(java.lang.String data)`
    `void` | `writeCharacters(char[] text, int start, int length)`
    `protected void` | `writeCharacters(java.lang.Object data, int type)`
    `void` | `writeCharacters(java.lang.String text)`
    `void` | `writeComment(java.lang.String data)`
    `protected abstract void` | `writeData(java.lang.Object data, int type)` Write characters/comment/dtd/entity data.
    `void` | `writeDefaultNamespace(java.lang.String namespaceURI)`
    `void` | `writeDTD(java.lang.String dtd)`
    `void` | `writeEmptyElement(java.lang.String localName)`
    `void` | `writeEmptyElement(java.lang.String namespaceURI, java.lang.String localName)`
    `void` | `writeEmptyElement(java.lang.String prefix, java.lang.String localName, java.lang.String namespaceURI)`
    `void` | `writeEndDocument()`
    `void` | `writeEndElement()`
    `protected abstract void` | `writeEndElementTag()` Write end element tag.
    `void` | `writeEntityRef(java.lang.String name)`
    `void` | `writeNamespace(java.lang.String prefix, java.lang.String namespaceURI)`
    `protected abstract void` | `writeNsDecl(java.lang.String prefix, java.lang.String namespaceURI)` Write namespace declaration.
    `protected abstract void` | `writePI(java.lang.String target, java.lang.String data)` Read processing instruction.
    `void` | `writeProcessingInstruction(java.lang.String target)`
    `void` | `writeProcessingInstruction(java.lang.String target, java.lang.String data)`
    `void` | `writeStartDocument()`
    `void` | `writeStartDocument(java.lang.String version)`
    `void` | `writeStartDocument(java.lang.String encoding, java.lang.String version)`
    `void` | `writeStartElement(java.lang.String localName)`
    `void` | `writeStartElement(java.lang.String namespaceURI, java.lang.String localName)`
    `void` | `writeStartElement(java.lang.String prefix, java.lang.String localName, java.lang.String namespaceURI)`
    `protected abstract T` | `writeStartElementTag(java.lang.String prefix, java.lang.String localPart, java.lang.String namespaceURI)` Write open start element tag.
    `protected abstract void` | `writeStartElementTagEnd()` Write close start element tag.

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

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

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

      `flush`

- - ### Constructor Detail

    - #### AbstractXMLStreamWriter

          public AbstractXMLStreamWriter(T rootInfo,
                                         boolean repaireNamespaces)

      Create writer instance.
      Parameters:
        `rootInfo` - root scope information

  - ### Method Detail

    - #### getScope

          protected XMLStreamWriterScope<T> getScope()

      Returns:
        current scope

    - #### isStartDocumentWritten

          protected boolean isStartDocumentWritten()

      Returns:
        `true` if `START_DOCUMENT` event has been written

    - #### writeStartElementTag

          protected abstract T writeStartElementTag(java.lang.String prefix,
                                                    java.lang.String localPart,
                                                    java.lang.String namespaceURI)
                                             throws javax.xml.stream.XMLStreamException

      Write open start element tag. The returned scope info is stored in the new scope and will be available via `getScope().getInfo()`.
      Parameters:
        `prefix` - element prefix (may be `XMLConstants.DEFAULT_NS_PREFIX`)
        `localPart` - local name
        `namespaceURI` - namespace URI
      Returns:
        new scope info
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartElementTagEnd

          protected abstract void writeStartElementTagEnd()
                                                   throws javax.xml.stream.XMLStreamException

      Write close start element tag.
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEndElementTag

          protected abstract void writeEndElementTag()
                                              throws javax.xml.stream.XMLStreamException

      Write end element tag.
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeAttr

          protected abstract void writeAttr(java.lang.String prefix,
                                            java.lang.String localName,
                                            java.lang.String namespaceURI,
                                            java.lang.String value)
                                     throws javax.xml.stream.XMLStreamException

      Write attribute.
      Parameters:
        `prefix` - attribute prefix (may be `XMLConstants.DEFAULT_NS_PREFIX`)
        `localName` - local name
        `namespaceURI` - namespace URI
        `value` - attribute value
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeNsDecl

          protected abstract void writeNsDecl(java.lang.String prefix,
                                              java.lang.String namespaceURI)
                                       throws javax.xml.stream.XMLStreamException

      Write namespace declaration.
      Parameters:
        `prefix` - namespace prefix
        `namespaceURI` - namespace URI
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeData

          protected abstract void writeData(java.lang.Object data,
                                            int type)
                                     throws javax.xml.stream.XMLStreamException

      Write characters/comment/dtd/entity data.
      Parameters:
        `data` - text/data
        `type` - one of `CHARACTERS, COMMENT, CDATA, DTD, ENTITY_REFERENCE, SPACE`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writePI

          protected abstract void writePI(java.lang.String target,
                                          java.lang.String data)
                                   throws javax.xml.stream.XMLStreamException

      Read processing instruction.
      Parameters:
        `target` - PI target
        `data` - PI data (may be `null`)
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartElement

          public void writeStartElement(java.lang.String localName)
                                 throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeStartElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartElement

          public void writeStartElement(java.lang.String namespaceURI,
                                        java.lang.String localName)
                                 throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeStartElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartElement

          public void writeStartElement(java.lang.String prefix,
                                        java.lang.String localName,
                                        java.lang.String namespaceURI)
                                 throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeStartElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEndElement

          public void writeEndElement()
                               throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeEndElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEmptyElement

          public void writeEmptyElement(java.lang.String localName)
                                 throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEmptyElement

          public void writeEmptyElement(java.lang.String namespaceURI,
                                        java.lang.String localName)
                                 throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEmptyElement

          public void writeEmptyElement(java.lang.String prefix,
                                        java.lang.String localName,
                                        java.lang.String namespaceURI)
                                 throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeAttribute

          public void writeAttribute(java.lang.String localName,
                                     java.lang.String value)
                              throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeAttribute` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeAttribute

          public void writeAttribute(java.lang.String namespaceURI,
                                     java.lang.String localName,
                                     java.lang.String value)
                              throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeAttribute` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeAttribute

          public void writeAttribute(java.lang.String prefix,
                                     java.lang.String namespaceURI,
                                     java.lang.String localName,
                                     java.lang.String value)
                              throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeAttribute` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeCharacters

          protected final void writeCharacters(java.lang.Object data,
                                               int type)
                                        throws javax.xml.stream.XMLStreamException

      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeCharacters

          public void writeCharacters(java.lang.String text)
                               throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeCharacters` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeCharacters

          public void writeCharacters(char[] text,
                                      int start,
                                      int length)
                               throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeCharacters` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeCData

          public void writeCData(java.lang.String data)
                          throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeCData` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartDocument

          public void writeStartDocument()
                                  throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeStartDocument` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartDocument

          public void writeStartDocument(java.lang.String version)
                                  throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeStartDocument` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeStartDocument

          public void writeStartDocument(java.lang.String encoding,
                                         java.lang.String version)
                                  throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeStartDocument` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEndDocument

          public void writeEndDocument()
                                throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeEndDocument` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### close

          public void close()
                     throws javax.xml.stream.XMLStreamException

      Specified by:
        `close` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeNamespace

          public void writeNamespace(java.lang.String prefix,
                                     java.lang.String namespaceURI)
                              throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeNamespace` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeDefaultNamespace

          public void writeDefaultNamespace(java.lang.String namespaceURI)
                                     throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeDefaultNamespace` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### getPrefix

          public java.lang.String getPrefix(java.lang.String namespaceURI)
                                     throws javax.xml.stream.XMLStreamException

      Specified by:
        `getPrefix` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### setPrefix

          public void setPrefix(java.lang.String prefix,
                                java.lang.String namespaceURI)
                         throws javax.xml.stream.XMLStreamException

      Specified by:
        `setPrefix` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### setDefaultNamespace

          public void setDefaultNamespace(java.lang.String namespaceURI)
                                   throws javax.xml.stream.XMLStreamException

      Specified by:
        `setDefaultNamespace` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### setNamespaceContext

          public void setNamespaceContext(javax.xml.namespace.NamespaceContext context)
                                   throws javax.xml.stream.XMLStreamException

      Specified by:
        `setNamespaceContext` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### getNamespaceContext

          public javax.xml.namespace.NamespaceContext getNamespaceContext()

      Specified by:
        `getNamespaceContext` in interface `javax.xml.stream.XMLStreamWriter`

    - #### writeComment

          public void writeComment(java.lang.String data)
                            throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeComment` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeProcessingInstruction

          public void writeProcessingInstruction(java.lang.String target)
                                          throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeProcessingInstruction` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeProcessingInstruction

          public void writeProcessingInstruction(java.lang.String target,
                                                 java.lang.String data)
                                          throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeProcessingInstruction` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeDTD

          public void writeDTD(java.lang.String dtd)
                        throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeDTD` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEntityRef

          public void writeEntityRef(java.lang.String name)
                              throws javax.xml.stream.XMLStreamException

      Specified by:
        `writeEntityRef` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### getProperty

          public java.lang.Object getProperty(java.lang.String name)
                                       throws java.lang.IllegalArgumentException

      Specified by:
        `getProperty` in interface `javax.xml.stream.XMLStreamWriter`
      Throws:
        `java.lang.IllegalArgumentException`

Copyright © 2005-2021 Apache Software Foundation. All Rights Reserved.