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 XMLEventConsumeradd in interface XMLEventWriterXMLStreamExceptionpublic 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 XMLEventWriterreader - XMLStreamExceptionpublic boolean isHandlingRequired(Characters characters)
public String marshalCharacters(Characters characters)
characters - the characters to be encoded.public void flush()
throws XMLStreamException
flush in interface XMLEventWriterXMLStreamExceptionpublic void close()
throws XMLStreamException
close in interface XMLEventWriterXMLStreamExceptionpublic String getPrefix(String uri) throws XMLStreamException
getPrefix in interface XMLEventWriterXMLStreamExceptionpublic void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix in interface XMLEventWriterXMLStreamExceptionpublic void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace in interface XMLEventWriterXMLStreamExceptionpublic void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext in interface XMLEventWriterXMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLEventWriterCopyright © 2003–2022 Atlassian. All rights reserved.