Package com.itextpdf.layout.hyphenation
Class PatternParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.itextpdf.layout.hyphenation.PatternParser
- All Implemented Interfaces:
-
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) void
endElement
(String uri, String local, String raw) void
void
protected void
void
parse
(InputStream stream, String name) Parses a hyphenation pattern file.void
Parses a hyphenation pattern file.void
startElement
(String uri, String local, String raw, Attributes attrs) void
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
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
PatternParser
Construct a pattern parser.- Parameters:
-
consumer
- a pattern consumer
-
-
Method Details
-
parse
Parses a hyphenation pattern file.- Parameters:
-
filename
- the filename - Throws:
-
HyphenationException
- In case of an exception while parsing -
FileNotFoundException
- If the specified file is not found
-
parse
Parses a hyphenation pattern file.- Parameters:
-
stream
- the InputStream for the file -
name
- unique key representing country-language combination - Throws:
-
HyphenationException
- In case of an exception while parsing
-
getExternalClasses
- Throws:
-
SAXException
- if not caught
-
startElement
public void startElement(String uri, String local, String raw, Attributes attrs) throws SAXException - Specified by:
-
startElement
in interfaceContentHandler
- Overrides:
-
startElement
in classDefaultHandler
- Throws:
-
SAXException
- if parsing of hyphenation classes resource xml has failed.
-
endElement
- Specified by:
-
endElement
in interfaceContentHandler
- Overrides:
-
endElement
in classDefaultHandler
-
characters
public void characters(char[] ch, int start, int length) - Specified by:
-
characters
in interfaceContentHandler
- Overrides:
-
characters
in classDefaultHandler
-
warning
- Specified by:
-
warning
in interfaceErrorHandler
- Overrides:
-
warning
in classDefaultHandler
-
error
- Specified by:
-
error
in interfaceErrorHandler
- Overrides:
-
error
in classDefaultHandler
-
fatalError
- Specified by:
-
fatalError
in interfaceErrorHandler
- Overrides:
-
fatalError
in classDefaultHandler
- Throws:
-
SAXException
-