Class PatternParser
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.lucene.analysis.compound.hyphenation.PatternParser
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class PatternParser extends org.xml.sax.helpers.DefaultHandler
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 Constructor Description PatternParser()
PatternParser(PatternConsumer consumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)
void
parse(java.io.File file)
Parses a hyphenation pattern file.void
parse(java.lang.String filename)
Parses a hyphenation pattern file.void
parse(org.xml.sax.InputSource source)
Parses a hyphenation pattern file.org.xml.sax.InputSource
resolveEntity(java.lang.String publicId, java.lang.String systemId)
void
setConsumer(PatternConsumer consumer)
void
startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)
-
-
-
Constructor Detail
-
PatternParser
public PatternParser()
-
PatternParser
public PatternParser(PatternConsumer consumer)
-
-
Method Detail
-
setConsumer
public void setConsumer(PatternConsumer consumer)
-
parse
public void parse(java.lang.String filename) throws java.io.IOException
Parses a hyphenation pattern file.- Parameters:
filename
- the filename- Throws:
java.io.IOException
- In case of an exception while parsing
-
parse
public void parse(java.io.File file) throws java.io.IOException
Parses a hyphenation pattern file.- Parameters:
file
- the pattern file- Throws:
java.io.IOException
- In case of an exception while parsing
-
parse
public void parse(org.xml.sax.InputSource source) throws java.io.IOException
Parses a hyphenation pattern file.- Parameters:
source
- the InputSource for the file- Throws:
java.io.IOException
- In case of an exception while parsing
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
- Specified by:
resolveEntity
in interfaceorg.xml.sax.EntityResolver
- Overrides:
resolveEntity
in classorg.xml.sax.helpers.DefaultHandler
-
startElement
public void startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
-
endElement
public void endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
-
characters
public void characters(char[] ch, int start, int length)
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- See Also:
ContentHandler.characters(char[], int, int)
-
-