## org.apache.fop.layout.hyphenation
Class PatternParser

    java.lang.Object
      |
      +--org.xml.sax.helpers.DefaultHandler
            |
            +--org.apache.fop.layout.hyphenation.PatternParser

public class PatternParser
extends org.xml.sax.helpers.DefaultHandler
implements PatternConsumer

A SAX document handler to read and parse hyphenation patterns from a XML file.

Author:
  Carlos Villegas <cav@uniscope.co.jp>

Constructor Summary
`PatternParser()`
`PatternParser(PatternConsumer consumer)`

Method Summary
`void` `addClass(java.lang.String c)` Add a character class.
`void` `addException(java.lang.String w, java.util.Vector e)` Add a hyphenation exception.
`void` `addPattern(java.lang.String p, java.lang.String v)` Add hyphenation patterns.
`void` `characters(char[] ch, int start, int length)` Characters.
`void` `endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)`
`void` `error(org.xml.sax.SAXParseException ex)` Error.
`void` `fatalError(org.xml.sax.SAXParseException ex)` Fatal error.
`protected static org.xml.sax.InputSource` `fileInputSource(java.lang.String filename)` create an InputSource from a file name
`protected java.lang.String` `getExceptionWord(java.util.Vector ex)`
`protected static java.lang.String` `getInterletterValues(java.lang.String pat)`
`protected static java.lang.String` `getPattern(java.lang.String word)`
`static void` `main(java.lang.String[] args)`
`protected java.util.Vector` `normalizeException(java.util.Vector ex)`
`void` `parse(java.lang.String filename)`
`protected java.lang.String` `readToken(java.lang.StringBuffer chars)`
`void` `setConsumer(PatternConsumer consumer)`
`void` `startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)` Start element.
`void` `warning(org.xml.sax.SAXParseException ex)` Warning.

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`

Constructor Detail

### PatternParser

    public PatternParser()
                  throws HyphenationException

### PatternParser

    public PatternParser(PatternConsumer consumer)
                  throws HyphenationException

Method Detail

### setConsumer

    public void setConsumer(PatternConsumer consumer)

### parse

    public void parse(java.lang.String filename)
               throws HyphenationException

### fileInputSource

    protected static org.xml.sax.InputSource fileInputSource(java.lang.String filename)
                                                      throws HyphenationException

  create an InputSource from a file name
  Parameters:
    `filename` - the name of the file
  Returns:
    the InputSource created

### readToken

    protected java.lang.String readToken(java.lang.StringBuffer chars)

### getPattern

    protected static java.lang.String getPattern(java.lang.String word)

### normalizeException

    protected java.util.Vector normalizeException(java.util.Vector ex)

### getExceptionWord

    protected java.lang.String getExceptionWord(java.util.Vector ex)

### getInterletterValues

    protected static java.lang.String getInterletterValues(java.lang.String pat)

### startElement

    public void startElement(java.lang.String uri,
                             java.lang.String local,
                             java.lang.String raw,
                             org.xml.sax.Attributes attrs)

  Start element.
  Overrides:
    startElement in class org.xml.sax.helpers.DefaultHandler

### endElement

    public void endElement(java.lang.String uri,
                           java.lang.String local,
                           java.lang.String raw)

  Overrides:
    endElement in class org.xml.sax.helpers.DefaultHandler

### characters

    public void characters(char[] ch,
                           int start,
                           int length)

  Characters.
  Overrides:
    characters in class org.xml.sax.helpers.DefaultHandler

### warning

    public void warning(org.xml.sax.SAXParseException ex)

  Warning.
  Overrides:
    warning in class org.xml.sax.helpers.DefaultHandler

### error

    public void error(org.xml.sax.SAXParseException ex)

  Error.
  Overrides:
    error in class org.xml.sax.helpers.DefaultHandler

### fatalError

    public void fatalError(org.xml.sax.SAXParseException ex)
                    throws org.xml.sax.SAXException

  Fatal error.
  Overrides:
    fatalError in class org.xml.sax.helpers.DefaultHandler

### addClass

    public void addClass(java.lang.String c)

  Description copied from interface: PatternConsumer
  Add a character class. A character class defines characters that are considered equivalent for the purpose of hyphenation (e.g. "aA"). It usually means to ignore case.
  Specified by:
    addClass in interface PatternConsumer

### addException

    public void addException(java.lang.String w,
                             java.util.Vector e)

  Description copied from interface: PatternConsumer
  Add a hyphenation exception. An exception replaces the result obtained by the algorithm for cases for which this fails or the user wants to provide his own hyphenation. A hyphenatedword is a vector of alternating String's and `Hyphen` instances
  Specified by:
    addException in interface PatternConsumer

### addPattern

    public void addPattern(java.lang.String p,
                           java.lang.String v)

  Description copied from interface: PatternConsumer
  Add hyphenation patterns.
  Specified by:
    addPattern in interface PatternConsumer
  Tags copied from interface: PatternConsumer
  Parameters:
    `pattern` -
    `values` - interletter values expressed as a string of digit characters.

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.