Class ConfluenceXMLEventWriter
java.lang.Object
com.atlassian.confluence.content.render.xhtml.ConfluenceXMLEventWriter
- All Implemented Interfaces:
XMLEventConsumer
,XMLEventWriter
This "Confluence" implementation of
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add
(XMLEventReader reader) The contract of this method specifies that all it does is loop and delegate toadd(javax.xml.stream.events.XMLEvent)
.void
close()
void
flush()
boolean
isHandlingRequired
(Characters characters) 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
void
setNamespaceContext
(NamespaceContext context) void
-
Constructor Details
-
ConfluenceXMLEventWriter
-
-
Method Details
-
add
- Specified by:
add
in interfaceXMLEventConsumer
- Specified by:
add
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
add
The contract of this method specifies that all it does is loop and delegate toadd(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)
.- Specified by:
add
in interfaceXMLEventWriter
- Parameters:
reader
-- Throws:
XMLStreamException
-
isHandlingRequired
-
marshalCharacters
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.- Parameters:
characters
- the characters to be encoded.- Returns:
- a String with the necessary entities encoded.
-
flush
- Specified by:
flush
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
close
- Specified by:
close
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
getPrefix
- Specified by:
getPrefix
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
setPrefix
- Specified by:
setPrefix
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
setDefaultNamespace
- Specified by:
setDefaultNamespace
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
setNamespaceContext
- Specified by:
setNamespaceContext
in interfaceXMLEventWriter
- Throws:
XMLStreamException
-
getNamespaceContext
- Specified by:
getNamespaceContext
in interfaceXMLEventWriter
-