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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) voidendElement(String uri, String local, String raw) protected StringgetExceptionWord(ArrayList<?> ex) protected static Stringprotected static StringgetPattern(String word) normalizeException(ArrayList<?> ex) voidParses a hyphenation pattern file.voidparse(InputSource source) Parses a hyphenation pattern file.protected StringreadToken(StringBuilder chars) resolveEntity(String publicId, String systemId) voidsetConsumer(PatternConsumer consumer) voidstartElement(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
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:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classDefaultHandler
-
startElement
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- See Also:
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- See Also:
-
characters
public void characters(char[] ch, int start, int length) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- See Also:
-