public class PatternParser extends DefaultHandler implements PatternConsumer
A SAX document handler to read and parse hyphenation patterns from a XML file.
This work was authored by Carlos Villegas (cav@uniscope.co.jp).
| Constructor and Description |
|---|
PatternParser()
Construct a pattern parser.
|
PatternParser(PatternConsumer consumer)
Construct a pattern parser.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClass(String c)
For testing purposes only.
|
void |
addException(String w,
ArrayList e)
For testing purposes only.
|
void |
addPattern(String p,
String v)
For testing purposes only.
|
void |
characters(char[] ch,
int start,
int length) |
void |
closeTestOut()
Close test out file.
|
void |
endElement(String uri,
String local,
String raw) |
void |
error(SAXParseException ex) |
void |
fatalError(SAXParseException ex) |
protected void |
getExternalClasses() |
static void |
main(String[] args)
Main entry point when used as an application.
|
void |
parse(File file)
Parses a hyphenation pattern file.
|
void |
parse(InputSource source)
Parses a hyphenation pattern file.
|
void |
parse(String filename)
Parses a hyphenation pattern file.
|
void |
setTestOut(PrintStream testOut)
Set test out stream.
|
void |
startElement(String uri,
String local,
String raw,
Attributes attrs) |
void |
warning(SAXParseException ex) |
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDeclpublic PatternParser()
throws HyphenationException
HyphenationException - if a hyphenation exception is raisedpublic PatternParser(PatternConsumer consumer) throws HyphenationException
consumer - a pattern consumerHyphenationException - if a hyphenation exception is raisedpublic void parse(String filename) throws HyphenationException
filename - the filenameHyphenationException - In case of an exception while parsingpublic void parse(File file) throws HyphenationException
file - the pattern fileHyphenationException - In case of an exception while parsingpublic void parse(InputSource source) throws HyphenationException
source - the InputSource for the fileHyphenationException - In case of an exception while parsingprotected void getExternalClasses()
throws SAXException
SAXException - if not caughtpublic void startElement(String uri, String local, String raw, Attributes attrs) throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandlerSAXExceptionpublic void endElement(String uri, String local, String raw)
endElement in interface ContentHandlerendElement in class DefaultHandlerpublic void characters(char[] ch,
int start,
int length)
characters in interface ContentHandlercharacters in class DefaultHandlerpublic void warning(SAXParseException ex)
warning in interface ErrorHandlerwarning in class DefaultHandlerpublic void error(SAXParseException ex)
error in interface ErrorHandlererror in class DefaultHandlerpublic void fatalError(SAXParseException ex) throws SAXException
fatalError in interface ErrorHandlerfatalError in class DefaultHandlerSAXExceptionpublic void addClass(String c)
addClass in interface PatternConsumerc - character grouppublic void addException(String w, ArrayList e)
Hyphen instancesaddException in interface PatternConsumerw - word to add as an exceptione - pre-hyphenated wordpublic void addPattern(String p, String v)
addPattern in interface PatternConsumerp - the patternv - interletter values expressed as a string of
digit characters.public void setTestOut(PrintStream testOut)
testOut - the testOut to setpublic void closeTestOut()
Copyright © 2023 Apache Software Foundation. All rights reserved.