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:
    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(XMLStreamWriter parent, boolean matchRoot, String... multiplePaths)` Create instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMultiplePath(String path)` Add path to trigger `<?xml-multiple?>` PI.
    `void` | `setParent(XMLStreamWriter parent)`
    `void` | `writeEmptyElement(String localName)`
    `void` | `writeEmptyElement(String namespaceURI, String localName)`
    `void` | `writeEmptyElement(String prefix, String localName, String namespaceURI)`
    `void` | `writeEndElement()`
    `void` | `writeStartElement(String localName)`
    `void` | `writeStartElement(String namespaceURI, String localName)`
    `void` | `writeStartElement(String prefix, String localName, 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(XMLStreamWriter parent,
                                         boolean matchRoot,
                                         String... multiplePaths)
                                  throws XMLStreamException

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

  - ### Method Detail

    - #### setParent

          public void setParent(XMLStreamWriter parent)

      Overrides:
        `setParent` in class `StreamWriterDelegate`

    - #### addMultiplePath

          public void addMultiplePath(String path)
                               throws 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:
        `XMLStreamException` - if the path is invalid

    - #### writeEmptyElement

          public void writeEmptyElement(String localName)
                                 throws XMLStreamException

      Specified by:
        `writeEmptyElement` in interface `XMLStreamWriter`
      Overrides:
        `writeEmptyElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### writeEmptyElement

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

      Specified by:
        `writeEmptyElement` in interface `XMLStreamWriter`
      Overrides:
        `writeEmptyElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### writeEmptyElement

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

      Specified by:
        `writeEmptyElement` in interface `XMLStreamWriter`
      Overrides:
        `writeEmptyElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### writeStartElement

          public void writeStartElement(String localName)
                                 throws XMLStreamException

      Specified by:
        `writeStartElement` in interface `XMLStreamWriter`
      Overrides:
        `writeStartElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### writeStartElement

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

      Specified by:
        `writeStartElement` in interface `XMLStreamWriter`
      Overrides:
        `writeStartElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### writeStartElement

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

      Specified by:
        `writeStartElement` in interface `XMLStreamWriter`
      Overrides:
        `writeStartElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### writeEndElement

          public void writeEndElement()
                               throws XMLStreamException

      Specified by:
        `writeEndElement` in interface `XMLStreamWriter`
      Overrides:
        `writeEndElement` in class `StreamWriterDelegate`
      Throws:
        `XMLStreamException`

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