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 and Description |
|---|
XMLMultipleEventWriter(XMLEventWriter parent,
boolean matchRoot,
String... multiplePaths)
Create instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(XMLEvent event) |
void |
add(XMLEventReader reader) |
void |
addMultiplePath(String path)
Add path to trigger
<?xml-multiple?> PI. |
void |
setParent(XMLEventWriter parent) |
close, flush, getNamespaceContext, getParent, getPrefix, setDefaultNamespace, setNamespaceContext, setPrefixpublic XMLMultipleEventWriter(XMLEventWriter parent, boolean matchRoot, String... multiplePaths) throws XMLStreamException
parent - delegatematchRoot - whether the root element is included in pathsmultiplePaths - added via addMultiplePath(String)XMLStreamExceptionpublic void setParent(XMLEventWriter parent)
setParent in class EventWriterDelegatepublic void addMultiplePath(String path) throws XMLStreamException
<?xml-multiple?> PI.
The path may start with '/' and contain local element
names, separated by '/', e.g
"/foo/bar", "foo/bar" or "bar".path - multiple pathXMLStreamException - if the path is invalidpublic void add(XMLEventReader reader) throws XMLStreamException
add in interface XMLEventWriteradd in class EventWriterDelegateXMLStreamExceptionpublic void add(XMLEvent event) throws XMLStreamException
add in interface XMLEventConsumeradd in interface XMLEventWriteradd in class EventWriterDelegateXMLStreamExceptionCopyright © 2005–2019 Apache Software Foundation. All rights reserved.