de.odysseus.staxon.json.util
Class XMLMultipleStreamWriter
java.lang.Object
de.odysseus.staxon.util.StreamWriterDelegate
de.odysseus.staxon.json.util.XMLMultipleStreamWriter
- All Implemented Interfaces:
- XMLStreamWriter
public class XMLMultipleStreamWriter
- extends StreamWriterDelegate
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.createXMLStreamWriter(...);
writer = new XMLMultipleStreamWriter(writer, false, "/alice/bob", ...);
| Methods inherited from class de.odysseus.staxon.util.StreamWriterDelegate |
close, flush, getNamespaceContext, getParent, getPrefix, getProperty, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEndDocument, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLMultipleStreamWriter
public XMLMultipleStreamWriter(XMLStreamWriter 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(XMLStreamWriter parent)
- Overrides:
setParent in class StreamWriterDelegate
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
writeEmptyElement
public void writeEmptyElement(String localName)
throws XMLStreamException
- Specified by:
writeEmptyElement in interface XMLStreamWriter- Overrides:
writeEmptyElement in class StreamWriterDelegate
- Throws:
XMLStreamException
writeEmptyElement
public void writeEmptyElement(String namespaceURI,
String localName)
throws XMLStreamException
- Specified by:
writeEmptyElement in interface XMLStreamWriter- Overrides:
writeEmptyElement in class StreamWriterDelegate
- Throws:
XMLStreamException
writeEmptyElement
public void writeEmptyElement(String prefix,
String localName,
String namespaceURI)
throws XMLStreamException
- Specified by:
writeEmptyElement in interface XMLStreamWriter- Overrides:
writeEmptyElement in class StreamWriterDelegate
- Throws:
XMLStreamException
writeStartElement
public void writeStartElement(String localName)
throws XMLStreamException
- Specified by:
writeStartElement in interface XMLStreamWriter- Overrides:
writeStartElement in class StreamWriterDelegate
- Throws:
XMLStreamException
writeStartElement
public void writeStartElement(String namespaceURI,
String localName)
throws XMLStreamException
- Specified by:
writeStartElement in interface XMLStreamWriter- Overrides:
writeStartElement in class StreamWriterDelegate
- Throws:
XMLStreamException
writeStartElement
public void writeStartElement(String prefix,
String localName,
String namespaceURI)
throws XMLStreamException
- Specified by:
writeStartElement in interface XMLStreamWriter- Overrides:
writeStartElement in class StreamWriterDelegate
- Throws:
XMLStreamException
writeEndElement
public void writeEndElement()
throws XMLStreamException
- Specified by:
writeEndElement in interface XMLStreamWriter- Overrides:
writeEndElement in class StreamWriterDelegate
- Throws:
XMLStreamException
Copyright © 2011-2012. All Rights Reserved.