Class SaxEventToXmlElementConverter
java.lang.Object
org.codice.ddf.transformer.xml.streaming.lib.SaxEventToXmlElementConverter
A library class used to turn SAX events back into their corresponding XML snippets
Not threadsafe
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNamespace(String prefix, String uri) Method used in ato populate theinvalid reference
SaxEventHandler#startElement(String, String, String, Attributes), which allows namespaceURI/prefix lookup.invalid reference
SaxEventToXmlElementConverter#namespaceMappingvoidremoveNamespace(String prefix) reset()Resets all stateful variables of theSaxEventToXmlElementConverterShould be used before expecting a fresh XML snippet Can be used instead of declaring a new onetoElement(char[] ch, int start, int length) Method used to reconstruct the characters/value of an XML element.Method used to reconstruct the end tag of an XML element.toElement(String uri, String localName, Attributes atts) Used to reconstruct the start tag of an XML element.toString()Overridden toString method to return the XML snippet that has been reconstructed
-
Constructor Details
-
SaxEventToXmlElementConverter
-
-
Method Details
-
toElement
public SaxEventToXmlElementConverter toElement(String uri, String localName, Attributes atts) throws XMLStreamException Used to reconstruct the start tag of an XML element.- Parameters:
uri- the URI that is passed in byinvalid reference
SaxEventHandlerlocalName- the localName that is passed in byinvalid reference
SaxEventHandleratts- the attributes that are passed in byinvalid reference
SaxEventHandler- Returns:
- this
- Throws:
XMLStreamException
-
toElement
public SaxEventToXmlElementConverter toElement(String uri, String localName) throws XMLStreamException Method used to reconstruct the end tag of an XML element.- Parameters:
uri- the namespaceURI that is passed in byinvalid reference
SaxEventHandlerlocalName- the localName that is passed in byinvalid reference
SaxEventHandler- Returns:
- this
- Throws:
XMLStreamException
-
toElement
public SaxEventToXmlElementConverter toElement(char[] ch, int start, int length) throws XMLStreamException Method used to reconstruct the characters/value of an XML element.- Parameters:
ch- the ch that is passed in byinvalid reference
SaxEventHandlerstart- the start that is passed in byinvalid reference
SaxEventHandlerlength- the length that is passed in byinvalid reference
SaxEventHandler- Returns:
- this
- Throws:
XMLStreamException
-
toString
Overridden toString method to return the XML snippet that has been reconstructed -
reset
Resets all stateful variables of theSaxEventToXmlElementConverterShould be used before expecting a fresh XML snippet Can be used instead of declaring a new one- Returns:
- this
-
addNamespace
Method used in ato populate theinvalid reference
SaxEventHandler#startElement(String, String, String, Attributes), which allows namespaceURI/prefix lookup. (Could potentially be used elsewhere, but one would have to ensure correct use)invalid reference
SaxEventToXmlElementConverter#namespaceMapping- Parameters:
prefix- the namespace prefix that is passed in byinvalid reference
SaxEventHandleruri- the namespace uri that is passed in byinvalid reference
SaxEventHandler- Throws:
XMLStreamException
-
removeNamespace
-