org.foray.hyphen
Class PatternParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.foray.hyphen.PatternParser
- All Implemented Interfaces:
- ContentHandler, DTDHandler, EntityResolver, ErrorHandler
public class PatternParser
- extends org.xml.sax.helpers.DefaultHandler
A SAX document handler to read and parse hyphenation patterns
from a XML file.
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 |
PatternParser
public PatternParser(PatternConsumer consumer,
org.apache.commons.logging.Log logger)
throws org.axsl.hyphen.HyphenationException
- Constructor.
- Parameters:
consumer
- The pattern consumer implementation that will accept the
data created by this parser.logger
- The logger for user messages.
- Throws:
org.axsl.hyphen.HyphenationException
- For errors during construction.
parse
public void parse(URL url)
throws org.axsl.hyphen.HyphenationException
- Parses a given URL, using the PatternConsumer to consume the data
retrieved during the parse.
- Parameters:
url
- The URL to parse.
- Throws:
org.axsl.hyphen.HyphenationException
- For errors during parsing.
readToken
protected String readToken(StringBuilder chars)
- Returns the next token from the buffer.
- Parameters:
chars
- The buffer which is being parsed.
- Returns:
- The next token.
startElement
public void startElement(String uri,
String local,
String raw,
Attributes attrs)
- Specified by:
startElement
in interface ContentHandler
- Overrides:
startElement
in class org.xml.sax.helpers.DefaultHandler
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.