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 SaxEventHandler
localName
- the localName that is passed in by SaxEventHandler
atts
- the attributes that are passed in by SaxEventHandler
SaxEventHandler#startElement
XMLStreamException
public SaxEventToXmlElementConverter toElement(String uri, String localName) throws XMLStreamException
uri
- the namespaceURI that is passed in by SaxEventHandler
localName
- the localName that is passed in by SaxEventHandler
SaxEventHandler#endElement
XMLStreamException
public SaxEventToXmlElementConverter toElement(char[] ch, int start, int length) throws XMLStreamException
ch
- the ch that is passed in by SaxEventHandler
start
- the start that is passed in by SaxEventHandler
length
- the length that is passed in by SaxEventHandler
SaxEventHandler#characters
XMLStreamException
public 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 SaxEventHandler
uri
- the namespace uri that is passed in by SaxEventHandler
XMLStreamException
public void removeNamespace(String prefix)
This work is licensed under a Creative Commons Attribution 4.0 International License.