public class PatternParser extends org.xml.sax.helpers.DefaultHandler
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(IPatternConsumer consumer)
Construct a pattern parser.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch, int start, int length) |
void |
endElement(String uri, String local, String raw) |
void |
error(SAXParseException ex) |
void |
fatalError(SAXParseException ex) |
protected void |
getExternalClasses() |
void |
parse(InputStream stream, String name)
Parses a hyphenation pattern file.
|
void |
parse(String filename)
Parses a hyphenation pattern file.
|
void |
startElement(String uri, String local, String raw, Attributes attrs) |
void |
warning(SAXParseException ex) |
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
public PatternParser(IPatternConsumer consumer) throws HyphenationException
consumer
- a pattern consumer
HyphenationException
- if a hyphenation exception is raised
public void parse(String filename) throws HyphenationException, FileNotFoundException
filename
- the filename
HyphenationException
- In case of an exception while parsing
FileNotFoundException
public void parse(InputStream stream, String name) throws HyphenationException
stream
- the InputStream for the file
name
- unique key representing country-language combination
HyphenationException
- In case of an exception while parsing
protected void getExternalClasses() throws SAXException
SAXException
- if not caught
public void startElement(String uri, String local, String raw, Attributes attrs) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
SAXException
public void endElement(String uri, String local, String raw)
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
public void characters(char[] ch, int start, int length)
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
public void warning(SAXParseException ex)
warning
in interface ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
public void error(SAXParseException ex)
error
in interface ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
public void fatalError(SAXParseException ex) throws SAXException
fatalError
in interface ErrorHandler
fatalError
in class org.xml.sax.helpers.DefaultHandler
SAXException
Copyright © 1998–2017 iText Group NV. All rights reserved.