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:
    XMLStreamWriter
  Direct Known Subclasses:
    JsonXMLStreamWriter

      public abstract class AbstractXMLStreamWriter<T>
      extends Object
      implements 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()`
    `NamespaceContext` | `getNamespaceContext()`
    `String` | `getPrefix(String namespaceURI)`
    `Object` | `getProperty(String name)`
    `protected XMLStreamWriterScope<T>` | `getScope()`
    `protected boolean` | `isStartDocumentWritten()`
    `void` | `setDefaultNamespace(String namespaceURI)`
    `void` | `setNamespaceContext(NamespaceContext context)`
    `void` | `setPrefix(String prefix, String namespaceURI)`
    `protected abstract void` | `writeAttr(String prefix, String localName, String namespaceURI, String value)` Write attribute.
    `void` | `writeAttribute(String localName, String value)`
    `void` | `writeAttribute(String namespaceURI, String localName, String value)`
    `void` | `writeAttribute(String prefix, String namespaceURI, String localName, String value)`
    `void` | `writeCData(String data)`
    `void` | `writeCharacters(char[] text, int start, int length)`
    `protected void` | `writeCharacters(Object data, int type)`
    `void` | `writeCharacters(String text)`
    `void` | `writeComment(String data)`
    `protected abstract void` | `writeData(Object data, int type)` Write characters/comment/dtd/entity data.
    `void` | `writeDefaultNamespace(String namespaceURI)`
    `void` | `writeDTD(String dtd)`
    `void` | `writeEmptyElement(String localName)`
    `void` | `writeEmptyElement(String namespaceURI, String localName)`
    `void` | `writeEmptyElement(String prefix, String localName, String namespaceURI)`
    `void` | `writeEndDocument()`
    `void` | `writeEndElement()`
    `protected abstract void` | `writeEndElementTag()` Write end element tag.
    `void` | `writeEntityRef(String name)`
    `void` | `writeNamespace(String prefix, String namespaceURI)`
    `protected abstract void` | `writeNsDecl(String prefix, String namespaceURI)` Write namespace declaration.
    `protected abstract void` | `writePI(String target, String data)` Read processing instruction.
    `void` | `writeProcessingInstruction(String target)`
    `void` | `writeProcessingInstruction(String target, String data)`
    `void` | `writeStartDocument()`
    `void` | `writeStartDocument(String version)`
    `void` | `writeStartDocument(String encoding, String version)`
    `void` | `writeStartElement(String localName)`
    `void` | `writeStartElement(String namespaceURI, String localName)`
    `void` | `writeStartElement(String prefix, String localName, String namespaceURI)`
    `protected abstract T` | `writeStartElementTag(String prefix, String localPart, 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(String prefix,
                                                    String localPart,
                                                    String namespaceURI)
                                             throws 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:
        `XMLStreamException`

    - #### writeStartElementTagEnd

          protected abstract void writeStartElementTagEnd()
                                                   throws XMLStreamException

      Write close start element tag.
      Throws:
        `XMLStreamException`

    - #### writeEndElementTag

          protected abstract void writeEndElementTag()
                                              throws XMLStreamException

      Write end element tag.
      Throws:
        `XMLStreamException`

    - #### writeAttr

          protected abstract void writeAttr(String prefix,
                                            String localName,
                                            String namespaceURI,
                                            String value)
                                     throws XMLStreamException

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

    - #### writeNsDecl

          protected abstract void writeNsDecl(String prefix,
                                              String namespaceURI)
                                       throws XMLStreamException

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

    - #### writeData

          protected abstract void writeData(Object data,
                                            int type)
                                     throws XMLStreamException

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

    - #### writePI

          protected abstract void writePI(String target,
                                          String data)
                                   throws XMLStreamException

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

    - #### writeStartElement

          public void writeStartElement(String localName)
                                 throws XMLStreamException

      Specified by:
        `writeStartElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeStartElement

          public void writeStartElement(String namespaceURI,
                                        String localName)
                                 throws XMLStreamException

      Specified by:
        `writeStartElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeStartElement

          public void writeStartElement(String prefix,
                                        String localName,
                                        String namespaceURI)
                                 throws XMLStreamException

      Specified by:
        `writeStartElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeEndElement

          public void writeEndElement()
                               throws XMLStreamException

      Specified by:
        `writeEndElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeEmptyElement

          public void writeEmptyElement(String localName)
                                 throws XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeEmptyElement

          public void writeEmptyElement(String namespaceURI,
                                        String localName)
                                 throws XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeEmptyElement

          public void writeEmptyElement(String prefix,
                                        String localName,
                                        String namespaceURI)
                                 throws XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeAttribute

          public void writeAttribute(String localName,
                                     String value)
                              throws XMLStreamException

      Specified by:
        `writeAttribute` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeAttribute

          public void writeAttribute(String namespaceURI,
                                     String localName,
                                     String value)
                              throws XMLStreamException

      Specified by:
        `writeAttribute` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeAttribute

          public void writeAttribute(String prefix,
                                     String namespaceURI,
                                     String localName,
                                     String value)
                              throws XMLStreamException

      Specified by:
        `writeAttribute` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeCharacters

          protected final void writeCharacters(Object data,
                                               int type)
                                        throws XMLStreamException

      Throws:
        `XMLStreamException`

    - #### writeCharacters

          public void writeCharacters(String text)
                               throws XMLStreamException

      Specified by:
        `writeCharacters` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeCharacters

          public void writeCharacters(char[] text,
                                      int start,
                                      int length)
                               throws XMLStreamException

      Specified by:
        `writeCharacters` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeCData

          public void writeCData(String data)
                          throws XMLStreamException

      Specified by:
        `writeCData` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeStartDocument

          public void writeStartDocument()
                                  throws XMLStreamException

      Specified by:
        `writeStartDocument` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeStartDocument

          public void writeStartDocument(String version)
                                  throws XMLStreamException

      Specified by:
        `writeStartDocument` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeStartDocument

          public void writeStartDocument(String encoding,
                                         String version)
                                  throws XMLStreamException

      Specified by:
        `writeStartDocument` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeEndDocument

          public void writeEndDocument()
                                throws XMLStreamException

      Specified by:
        `writeEndDocument` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### close

          public void close()
                     throws XMLStreamException

      Specified by:
        `close` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeNamespace

          public void writeNamespace(String prefix,
                                     String namespaceURI)
                              throws XMLStreamException

      Specified by:
        `writeNamespace` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeDefaultNamespace

          public void writeDefaultNamespace(String namespaceURI)
                                     throws XMLStreamException

      Specified by:
        `writeDefaultNamespace` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### getPrefix

          public String getPrefix(String namespaceURI)
                           throws XMLStreamException

      Specified by:
        `getPrefix` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### setPrefix

          public void setPrefix(String prefix,
                                String namespaceURI)
                         throws XMLStreamException

      Specified by:
        `setPrefix` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### setDefaultNamespace

          public void setDefaultNamespace(String namespaceURI)
                                   throws XMLStreamException

      Specified by:
        `setDefaultNamespace` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### setNamespaceContext

          public void setNamespaceContext(NamespaceContext context)
                                   throws XMLStreamException

      Specified by:
        `setNamespaceContext` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### getNamespaceContext

          public NamespaceContext getNamespaceContext()

      Specified by:
        `getNamespaceContext` in interface `XMLStreamWriter`

    - #### writeComment

          public void writeComment(String data)
                            throws XMLStreamException

      Specified by:
        `writeComment` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeProcessingInstruction

          public void writeProcessingInstruction(String target)
                                          throws XMLStreamException

      Specified by:
        `writeProcessingInstruction` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeProcessingInstruction

          public void writeProcessingInstruction(String target,
                                                 String data)
                                          throws XMLStreamException

      Specified by:
        `writeProcessingInstruction` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeDTD

          public void writeDTD(String dtd)
                        throws XMLStreamException

      Specified by:
        `writeDTD` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### writeEntityRef

          public void writeEntityRef(String name)
                              throws XMLStreamException

      Specified by:
        `writeEntityRef` in interface `XMLStreamWriter`
      Throws:
        `XMLStreamException`

    - #### getProperty

          public Object getProperty(String name)
                             throws IllegalArgumentException

      Specified by:
        `getProperty` in interface `XMLStreamWriter`
      Throws:
        `IllegalArgumentException`

Copyright © 2005–2020 Apache Software Foundation. All rights reserved.