public class PatternParser extends org.xml.sax.helpers.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(java.lang.String c)
For testing purposes only.
|
void |
addException(java.lang.String w,
java.util.ArrayList e)
For testing purposes only.
|
void |
addPattern(java.lang.String p,
java.lang.String v)
For testing purposes only.
|
void |
characters(char[] ch,
int start,
int length) |
void |
closeTestOut()
Close test out file.
|
void |
endElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw) |
void |
error(org.xml.sax.SAXParseException ex) |
void |
fatalError(org.xml.sax.SAXParseException ex) |
protected void |
getExternalClasses() |
static void |
main(java.lang.String[] args)
Main entry point when used as an application.
|
void |
parse(java.io.File file)
Parses a hyphenation pattern file.
|
void |
parse(org.xml.sax.InputSource source)
Parses a hyphenation pattern file.
|
void |
parse(java.lang.String filename)
Parses a hyphenation pattern file.
|
void |
setTestOut(java.io.PrintStream testOut)
Set test out stream.
|
void |
startElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw,
org.xml.sax.Attributes attrs) |
void |
warning(org.xml.sax.SAXParseException ex) |
public 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(java.lang.String filename)
throws HyphenationException
filename - the filenameHyphenationException - In case of an exception while parsingpublic void parse(java.io.File file)
throws HyphenationException
file - the pattern fileHyphenationException - In case of an exception while parsingpublic void parse(org.xml.sax.InputSource source)
throws HyphenationException
source - the InputSource for the fileHyphenationException - In case of an exception while parsingprotected void getExternalClasses()
throws org.xml.sax.SAXException
org.xml.sax.SAXException - if not caughtpublic void startElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw,
org.xml.sax.Attributes attrs)
throws org.xml.sax.SAXException
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void endElement(java.lang.String uri,
java.lang.String local,
java.lang.String raw)
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerpublic void characters(char[] ch,
int start,
int length)
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerpublic void warning(org.xml.sax.SAXParseException ex)
warning in interface org.xml.sax.ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlerpublic void error(org.xml.sax.SAXParseException ex)
error in interface org.xml.sax.ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerpublic void fatalError(org.xml.sax.SAXParseException ex)
throws org.xml.sax.SAXException
fatalError in interface org.xml.sax.ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionpublic void addClass(java.lang.String c)
addClass in interface PatternConsumerc - character grouppublic void addException(java.lang.String w,
java.util.ArrayList e)
Hyphen instancesaddException in interface PatternConsumerw - word to add as an exceptione - pre-hyphenated wordpublic void addPattern(java.lang.String p,
java.lang.String v)
addPattern in interface PatternConsumerp - the patternv - interletter values expressed as a string of
digit characters.public void setTestOut(java.io.PrintStream testOut)
testOut - the testOut to setpublic void closeTestOut()
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - array of command line argumentsjava.lang.Exception - in case of uncaught exceptionCopyright 1999-2022 The Apache Software Foundation. All Rights Reserved.