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:
    javax.xml.stream.util.XMLEventConsumer, javax.xml.stream.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 and Description
    `XMLMultipleEventWriter(javax.xml.stream.XMLEventWriter parent, boolean matchRoot, java.lang.String... multiplePaths)` Create instance.

  - ### Method Summary

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

      Overrides:
        `setParent` in class `EventWriterDelegate`

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

    - #### add

          public void add(javax.xml.stream.XMLEventReader reader)
                   throws javax.xml.stream.XMLStreamException

      Specified by:
        `add` in interface `javax.xml.stream.XMLEventWriter`
      Overrides:
        `add` in class `EventWriterDelegate`
      Throws:
        `javax.xml.stream.XMLStreamException`

    - #### add

          public void add(javax.xml.stream.events.XMLEvent event)
                   throws javax.xml.stream.XMLStreamException

      Specified by:
        `add` in interface `javax.xml.stream.util.XMLEventConsumer`
      Specified by:
        `add` in interface `javax.xml.stream.XMLEventWriter`
      Overrides:
        `add` in class `EventWriterDelegate`
      Throws:
        `javax.xml.stream.XMLStreamException`

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