H- the type of handler to which this parser sends events
public abstract class XMLParser<H extends Handler> extends InputSourceParser<H>
XMLParseradapts a handler to be used to handle text extracted from an XML source. The parser implements
DefaultHandlerthat is constructed by means of the abstract method
getXMLHandler(). The parsing method traps thrown instances of
SAXExceptionand converts them to instances of
IOExceptionbefore rethrowing them in order to confrom to the specification of
|Constructor and Description|
Construct an XML parser with a
Construct an XML parser with the specified handler.
|Modifier and Type||Method and Description|
Return the default handler for SAX events.
Parse the specified input source.
getHandler, parse, parse, parse, parse, parseString, setHandler
public XMLParser(H handler)
handler- Handler to use for parsing.
protected abstract DefaultHandler getXMLHandler()
Handlerspecified for this class and pass events to it extracted from the XML. Typical concrete implementations of this method will extract the underlying handler using
Parser.getHandler()and wrap it in a default handler.
This method is called exactly once in each parse method in this class. Thus dynamic updates to the underlying handler may be picked up by this adapter method.
public void parse(InputSource inSource) throws IOException
getXMLHandler()method as the handler for SAX events generated by parsing the specified input source.
All SAX exceptions thrown by XML parsing are converted to I/O exceptions and rethrown; this step is required by the parent class's specification of this method.