Class 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.
    • 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)  
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PatternParser

        public PatternParser()
    • Method Detail

      • 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 interface org.xml.sax.EntityResolver
        Overrides:
        resolveEntity in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
        See Also:
        ContentHandler.characters(char[], int, int)