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
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
ConstructorsConstructorDescriptionXMLMultipleEventWriter(XMLEventWriter parent, boolean matchRoot, String... multiplePaths) Create instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidadd(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 Details
-
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 Details
-
setParent
- Overrides:
setParentin classEventWriterDelegate
-
addMultiplePath
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
- Specified by:
addin interfaceXMLEventWriter- Overrides:
addin classEventWriterDelegate- Throws:
XMLStreamException
-
add
- Specified by:
addin interfaceXMLEventConsumer- Specified by:
addin interfaceXMLEventWriter- Overrides:
addin classEventWriterDelegate- Throws:
XMLStreamException
-