public class ConfluenceXMLEventWriter extends Object implements XMLEventWriter
XMLEventWriter
was introduced primarily to deal with
STAX-58.
The intention is to wrap the default XMLEventWriter and intercept calls to add(javax.xml.stream.events.XMLEvent)
and add(javax.xml.stream.XMLEventReader)
and write characters correctly (rather than allowing woodstox to handle it incorrectly).Constructor and Description |
---|
ConfluenceXMLEventWriter(XMLEventWriter xmlEventWriter,
Writer writer) |
Modifier and Type | Method and Description |
---|---|
void |
add(XMLEvent event) |
void |
add(XMLEventReader reader)
The contract of this method specifies that all it does is loop and delegate to
add(javax.xml.stream.events.XMLEvent) . |
void |
close() |
void |
flush() |
NamespaceContext |
getNamespaceContext() |
String |
getPrefix(String uri) |
boolean |
isHandlingRequired(Characters characters) |
String |
marshalCharacters(Characters characters)
Check for the 3 characters that should be encoded but that aren't by StAX and ensure their encoded
form is used in the returned String.
|
void |
setDefaultNamespace(String uri) |
void |
setNamespaceContext(NamespaceContext context) |
void |
setPrefix(String prefix,
String uri) |
public ConfluenceXMLEventWriter(XMLEventWriter xmlEventWriter, Writer writer)
public void add(XMLEvent event) throws XMLStreamException
add
in interface XMLEventConsumer
add
in interface XMLEventWriter
XMLStreamException
public void add(XMLEventReader reader) throws XMLStreamException
add(javax.xml.stream.events.XMLEvent)
.
In our implementation, we do the same, except we invoke our customized version of add(javax.xml.stream.events.XMLEvent)
.add
in interface XMLEventWriter
reader
- XMLStreamException
public boolean isHandlingRequired(Characters characters)
public String marshalCharacters(Characters characters)
characters
- the characters to be encoded.public void flush() throws XMLStreamException
flush
in interface XMLEventWriter
XMLStreamException
public void close() throws XMLStreamException
close
in interface XMLEventWriter
XMLStreamException
public String getPrefix(String uri) throws XMLStreamException
getPrefix
in interface XMLEventWriter
XMLStreamException
public void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix
in interface XMLEventWriter
XMLStreamException
public void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace
in interface XMLEventWriter
XMLStreamException
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext
in interface XMLEventWriter
XMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLEventWriter
Copyright © 2003–2015 Atlassian. All rights reserved.