Package eu.woolplatform.utils.xml
Interface SimpleSAXHandler<T>
-
- All Known Implementing Classes:
AbstractSimpleSAXHandler
public interface SimpleSAXHandler<T>This is a simplified handler for SAX XML parsers. It can be used with aSimpleSAXParser. The handler receives XML events from a SAX parser and constructs an object of a specified type. If the parser completes without errors, the object can be obtained withgetObject().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcharacters(String ch, List<String> parents)Called when text content is found.voidendElement(String name, List<String> parents)Called when the end tag of a new element is found.TgetObject()Returns the object that was constructed from the XML code.voidstartElement(String name, Attributes atts, List<String> parents)Called when the start tag of a new element is found.
-
-
-
Method Detail
-
startElement
void startElement(String name, Attributes atts, List<String> parents) throws ParseException
Called when the start tag of a new element is found.- Parameters:
name- the name of the elementatts- the attributes defined in the start tagparents- the parents of the new element (ending with the direct parent)- Throws:
ParseException- if the content is invalid
-
endElement
void endElement(String name, List<String> parents) throws ParseException
Called when the end tag of a new element is found.- Parameters:
name- the name of the elementparents- the parents of the element (ending with the direct parent)- Throws:
ParseException- if the content is invalid
-
characters
void characters(String ch, List<String> parents) throws ParseException
Called when text content is found. This method is called when the text node is completed, so all consecutive characters are included in one string. It also includes all whitespace.- Parameters:
ch- the textparents- the names of the elements that are parents of the text node (ending with the direct parent)- Throws:
ParseException- if the content is invalid
-
getObject
T getObject()
Returns the object that was constructed from the XML code. This method can be called if the parser completed without errors.- Returns:
- the object
-
-