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 voidadd(XMLEvent event)voidadd(XMLEventReader reader)voidaddMultiplePath(String path)Add path to trigger<?xml-multiple?>PI.voidsetParent(XMLEventWriter parent)-
Methods inherited from class org.apache.synapse.commons.staxon.core.util.EventWriterDelegate
close, flush, getNamespaceContext, getParent, getPrefix, setDefaultNamespace, setNamespaceContext, setPrefix
-
-
-
-
Constructor Detail
-
XMLMultipleEventWriter
public XMLMultipleEventWriter(XMLEventWriter parent, boolean matchRoot, String... multiplePaths) throws XMLStreamException
Create instance.- Parameters:
parent- delegatematchRoot- whether the root element is included in pathsmultiplePaths- added viaaddMultiplePath(String)- Throws:
XMLStreamException
-
-
Method Detail
-
setParent
public void setParent(XMLEventWriter parent)
- Overrides:
setParentin classEventWriterDelegate
-
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:
addin interfaceXMLEventWriter- Overrides:
addin classEventWriterDelegate- Throws:
XMLStreamException
-
add
public void add(XMLEvent event) throws XMLStreamException
- Specified by:
addin interfaceXMLEventConsumer- Specified by:
addin interfaceXMLEventWriter- Overrides:
addin classEventWriterDelegate- Throws:
XMLStreamException
-
-