de.odysseus.staxon.json.util
Class XMLMultipleEventWriter
java.lang.Object
de.odysseus.staxon.util.EventWriterDelegate
de.odysseus.staxon.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", ...);
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 via addMultiplePath(String)
- Throws:
XMLStreamException
setParent
public void setParent(XMLEventWriter parent)
- Overrides:
setParent in class EventWriterDelegate
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:
add in interface XMLEventWriter- Overrides:
add in class EventWriterDelegate
- Throws:
XMLStreamException
add
public void add(XMLEvent event)
throws XMLStreamException
- Specified by:
add in interface XMLEventConsumer- Specified by:
add in interface XMLEventWriter- Overrides:
add in class EventWriterDelegate
- Throws:
XMLStreamException
Copyright © 2011-2012. All Rights Reserved.