Class PatternParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.lucene.analysis.compound.hyphenation.PatternParser
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
A SAX document handler to read and parse hyphenation patterns from a XML file.
This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) void
endElement
(String uri, String local, String raw) protected String
getExceptionWord
(ArrayList<?> ex) protected static String
protected static String
getPattern
(String word) normalizeException
(ArrayList<?> ex) void
Parses a hyphenation pattern file.void
parse
(InputSource source) Parses a hyphenation pattern file.protected String
readToken
(StringBuilder chars) resolveEntity
(String publicId, String systemId) void
setConsumer
(PatternConsumer consumer) void
startElement
(String uri, String local, String raw, Attributes attrs) Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
Constructor Details
-
PatternParser
public PatternParser() -
PatternParser
-
-
Method Details
-
setConsumer
-
parse
Parses a hyphenation pattern file.- Parameters:
filename
- the filename- Throws:
IOException
- In case of an exception while parsing
-
parse
Parses a hyphenation pattern file.- Parameters:
source
- the InputSource for the file- Throws:
IOException
- In case of an exception while parsing
-
readToken
-
getPattern
-
normalizeException
-
getExceptionWord
-
getInterletterValues
-
resolveEntity
- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
-
startElement
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- See Also:
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- See Also:
-
characters
public void characters(char[] ch, int start, int length) - Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- See Also:
-