org.foray.hyphen.util
Class NatLangParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.foray.hyphen.util.NatLangParser
- All Implemented Interfaces:
- ContentHandler, DTDHandler, EntityResolver, ErrorHandler
public class NatLangParser
- extends org.xml.sax.helpers.DefaultHandler
A SAX document handler to read and parse natural-language descriptions
from an XML file.
|
Constructor Summary |
NatLangParser(org.apache.commons.logging.Log logger)
Constructor. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NatLangParser
public NatLangParser(org.apache.commons.logging.Log logger)
- Constructor.
- Parameters:
logger - The logger for user messages.
parse
public NaturalLanguage parse(URL url)
throws org.axsl.hyphen.HyphenationException
- Parses a given URL, creating a new NaturalLanguage instance for the
contents.
- Parameters:
url - The URL to parse.
- Returns:
- The newly-parsed NaturalLanguage instance.
- Throws:
org.axsl.hyphen.HyphenationException - For errors during parsing.
startElement
public void startElement(String uri,
String local,
String raw,
Attributes attrs)
throws SAXException
- Specified by:
startElement in interface ContentHandler- Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
- Throws:
SAXException
endElement
public void endElement(String uri,
String local,
String raw)
- Specified by:
endElement in interface ContentHandler- Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
characters
public void characters(char[] ch,
int start,
int length)
- Specified by:
characters in interface ContentHandler- Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
warning
public void warning(SAXParseException ex)
- Specified by:
warning in interface ErrorHandler- Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
error
public void error(SAXParseException ex)
- Specified by:
error in interface ErrorHandler- Overrides:
error in class org.xml.sax.helpers.DefaultHandler
fatalError
public void fatalError(SAXParseException ex)
throws SAXException
- Specified by:
fatalError in interface ErrorHandler- Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
- Throws:
SAXException
Copyright © 2017. All rights reserved.