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

## Class XMLMultipleEventWriter

- java.lang.Object
- - org.apache.synapse.commons.staxon.core.util.EventWriterDelegate
  - - org.apache.synapse.commons.staxon.core.json.util.XMLMultipleEventWriter

- All Implemented Interfaces:
    `XMLEventConsumer`, `XMLEventWriter`

      public class XMLMultipleEventWriter
      extends EventWriterDelegate

  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.createXMLEventWriter(...);
       writer = new XMLMultipleEventWriter(writer, false, "/alice/bob", ...);

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XMLMultipleEventWriter​(XMLEventWriter parent, boolean matchRoot, String... multiplePaths)` | Create instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(XMLEvent event)` |
    `void` | `add​(XMLEventReader reader)` |
    `void` | `addMultiplePath​(String path)` | Add path to trigger `<?xml-multiple?>` PI.
    `void` | `setParent​(XMLEventWriter parent)` |

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

      `close, flush, getNamespaceContext, getParent, getPrefix, setDefaultNamespace, setNamespaceContext, setPrefix`

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

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

- - ### Constructor Detail

    - #### XMLMultipleEventWriter

          public XMLMultipleEventWriter​(XMLEventWriter 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​(XMLEventWriter parent)

      Overrides:
        `setParent` in class `EventWriterDelegate`

    - #### 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

    - #### add

          public void add​(XMLEventReader reader)
                   throws XMLStreamException

      Specified by:
        `add` in interface `XMLEventWriter`
      Overrides:
        `add` in class `EventWriterDelegate`
      Throws:
        `XMLStreamException`

    - #### add

          public void add​(XMLEvent event)
                   throws XMLStreamException

      Specified by:
        `add` in interface `XMLEventConsumer`
      Specified by:
        `add` in interface `XMLEventWriter`
      Overrides:
        `add` in class `EventWriterDelegate`
      Throws:
        `XMLStreamException`