public class SaxEventToXmlElementConverter extends Object
Not threadsafe
| Constructor and Description |
|---|
SaxEventToXmlElementConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addNamespace(String prefix,
String uri)
Method used in a
SaxEventHandler#startElement(String, String, String, Attributes) to
populate the SaxEventToXmlElementConverter#namespaceMapping, which allows
namespaceURI/prefix lookup. |
void |
removeNamespace(String prefix) |
SaxEventToXmlElementConverter |
reset()
Resets all stateful variables of the
SaxEventToXmlElementConverter Should be used
before expecting a fresh XML snippet Can be used instead of declaring a new one |
SaxEventToXmlElementConverter |
toElement(char[] ch,
int start,
int length)
Method used to reconstruct the characters/value of an XML element.
|
SaxEventToXmlElementConverter |
toElement(String uri,
String localName)
Method used to reconstruct the end tag of an XML element.
|
SaxEventToXmlElementConverter |
toElement(String uri,
String localName,
Attributes atts)
Used to reconstruct the start tag of an XML element.
|
String |
toString()
Overridden toString method to return the XML snippet that has been reconstructed
|
public SaxEventToXmlElementConverter()
throws UnsupportedEncodingException,
XMLStreamException
public SaxEventToXmlElementConverter toElement(String uri, String localName, Attributes atts) throws XMLStreamException
uri - the URI that is passed in by SaxEventHandlerlocalName - the localName that is passed in by SaxEventHandleratts - the attributes that are passed in by SaxEventHandlerSaxEventHandler#startElementXMLStreamExceptionpublic SaxEventToXmlElementConverter toElement(String uri, String localName) throws XMLStreamException
uri - the namespaceURI that is passed in by SaxEventHandlerlocalName - the localName that is passed in by SaxEventHandlerSaxEventHandler#endElementXMLStreamExceptionpublic SaxEventToXmlElementConverter toElement(char[] ch, int start, int length) throws XMLStreamException
ch - the ch that is passed in by SaxEventHandlerstart - the start that is passed in by SaxEventHandlerlength - the length that is passed in by SaxEventHandlerSaxEventHandler#charactersXMLStreamExceptionpublic String toString()
public SaxEventToXmlElementConverter reset()
SaxEventToXmlElementConverter Should be used
before expecting a fresh XML snippet Can be used instead of declaring a new onepublic void addNamespace(String prefix, String uri) throws XMLStreamException
SaxEventHandler#startElement(String, String, String, Attributes) to
populate the SaxEventToXmlElementConverter#namespaceMapping, which allows
namespaceURI/prefix lookup. (Could potentially be used elsewhere, but one would have to ensure
correct use)prefix - the namespace prefix that is passed in by SaxEventHandleruri - the namespace uri that is passed in by SaxEventHandlerXMLStreamExceptionpublic void removeNamespace(String prefix)
This work is licensed under a Creative Commons Attribution 4.0 International License.