|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.corpus.Parser<H>
com.aliasi.corpus.InputSourceParser<H>
com.aliasi.corpus.XMLParser<H>
H - the type of handler to which this parser sends eventspublic abstract class XMLParser<H extends Handler>
An XMLParser adapts a handler to be used to handle
text extracted from an XML source. The parser implements parse(InputSource) using an XMLReader and an DefaultHandler that is constructed by means of the abstract method
getXMLHandler(). The parsing method traps
thrown instances of SAXException and converts them to instances of
IOException before rethrowing them in order to confrom to
the specification of Parser.parse(InputSource).
| Constructor Summary | |
|---|---|
XMLParser()
Construct an XML parser with a null handler. |
|
XMLParser(H handler)
Construct an XML parser with the specified handler. |
|
| Method Summary | |
|---|---|
protected abstract DefaultHandler |
getXMLHandler()
Return the default handler for SAX events. |
void |
parse(InputSource inSource)
Parse the specified input source. |
| Methods inherited from class com.aliasi.corpus.InputSourceParser |
|---|
parseString |
| Methods inherited from class com.aliasi.corpus.Parser |
|---|
getHandler, parse, parse, parse, parse, parseString, setHandler |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLParser()
null handler.
public XMLParser(H handler)
handler - Handler to use for parsing.| Method Detail |
|---|
protected abstract DefaultHandler getXMLHandler()
Handler specified 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.
parse in class Parser<H extends Handler>inSource - Input source to parse.
IOException - If there is an I/O exception or a SAX
exception raised while parsing.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||