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, setPrefix
public XMLMultipleEventWriter(XMLEventWriter parent, boolean matchRoot, String... multiplePaths) throws XMLStreamException
parent
- delegatematchRoot
- whether the root element is included in pathsmultiplePaths
- added via addMultiplePath(String)
XMLStreamException
public void setParent(XMLEventWriter parent)
setParent
in class EventWriterDelegate
public 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 XMLEventWriter
add
in class EventWriterDelegate
XMLStreamException
public void add(XMLEvent event) throws XMLStreamException
add
in interface XMLEventConsumer
add
in interface XMLEventWriter
add
in class EventWriterDelegate
XMLStreamException
Copyright © 2005–2019 Apache Software Foundation. All rights reserved.