org.apache.synapse.commons.staxon.core.json.util

## Class XMLMultipleStreamWriter

- java.lang.Object
- - org.apache.synapse.commons.staxon.core.util.StreamWriterDelegate
  - - org.apache.synapse.commons.staxon.core.json.util.XMLMultipleStreamWriter

- All Implemented Interfaces:
    javax.xml.stream.XMLStreamWriter

      public class XMLMultipleStreamWriter
      extends StreamWriterDelegate

  Simple delegate writer which generates `<?xml-multiple?>` processing instructions when writing a sequence of elements matching some element path. Use this class to trigger JSON array start events like this:

       XMLOutputFactory factory = new JsonXMLOutputFactory();
       XMLEventWriter writer = factory.createXMLStreamWriter(...);
       writer = new XMLMultipleStreamWriter(writer, false, "/alice/bob", ...);

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLMultipleStreamWriter(javax.xml.stream.XMLStreamWriter parent, boolean matchRoot, java.lang.String... multiplePaths)` Create instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMultiplePath(java.lang.String path)` Add path to trigger `<?xml-multiple?>` PI.
    `void` | `setParent(javax.xml.stream.XMLStreamWriter parent)`
    `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` | `writeEndElement()`
    `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)`

    - ### Methods inherited from class org.apache.synapse.commons.staxon.core.util.StreamWriterDelegate

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

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

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

- - ### Constructor Detail

    - #### XMLMultipleStreamWriter

          public XMLMultipleStreamWriter(javax.xml.stream.XMLStreamWriter parent,
                                         boolean matchRoot,
                                         java.lang.String... multiplePaths)
                                  throws javax.xml.stream.XMLStreamException

      Create instance.
      Parameters:
        `parent` - delegate
        `matchRoot` - whether the root element is included in paths
        `multiplePaths` - added via `addMultiplePath(String)`
      Throws:
        `javax.xml.stream.XMLStreamException`

  - ### Method Detail

    - #### setParent

          public void setParent(javax.xml.stream.XMLStreamWriter parent)

      Overrides:
        `setParent` in class `StreamWriterDelegate`

    - #### addMultiplePath

          public void addMultiplePath(java.lang.String path)
                               throws javax.xml.stream.XMLStreamException

      Add path to trigger `<?xml-multiple?>` PI. The path may start with `'/'` and contain local element names, separated by `'/'`, e.g `"/foo/bar"`, `"foo/bar"` or `"bar"`.
      Parameters:
        `path` - multiple path
      Throws:
        `javax.xml.stream.XMLStreamException` - if the path is invalid

    - #### writeEmptyElement

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

      Specified by:
        `writeEmptyElement` in interface `javax.xml.stream.XMLStreamWriter`
      Overrides:
        `writeEmptyElement` in class `StreamWriterDelegate`
      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`
      Overrides:
        `writeEmptyElement` in class `StreamWriterDelegate`
      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`
      Overrides:
        `writeEmptyElement` in class `StreamWriterDelegate`
      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`
      Overrides:
        `writeStartElement` in class `StreamWriterDelegate`
      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`
      Overrides:
        `writeStartElement` in class `StreamWriterDelegate`
      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`
      Overrides:
        `writeStartElement` in class `StreamWriterDelegate`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### writeEndElement

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

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

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