Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.hyphenation
Class PatternParser

    java.lang.Object
      org.xml.sax.helpers.DefaultHandler
          org.apache.fop.hyphenation.PatternParser

All Implemented Interfaces:
  org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, PatternConsumer

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

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.ArrayList 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)`
`void` | `closeTestOut()`
`void` | `endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)`
`void` | `error(org.xml.sax.SAXParseException ex)`
`void` | `fatalError(org.xml.sax.SAXParseException ex)`
`protected java.lang.String` | `getExceptionWord(java.util.ArrayList ex)`
`protected void` | `getExternalClasses()`
`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.ArrayList` | `normalizeException(java.util.ArrayList ex)`
`void` | `parse(java.io.File file)` Parses a hyphenation pattern file.
`void` | `parse(org.xml.sax.InputSource source)` Parses a hyphenation pattern file.
`void` | `parse(java.lang.String filename)` Parses a hyphenation pattern file.
`protected java.lang.String` | `readToken(java.lang.StringBuffer chars)`
`void` | `setTestOut(java.io.PrintStream testOut)`
`void` | `startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)`
`void` | `warning(org.xml.sax.SAXParseException ex)`

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

### parse

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

  Parses a hyphenation pattern file.

  Parameters:
    `filename` - the filename
  Throws:
    `HyphenationException` - In case of an exception while parsing

### parse

    public void parse(java.io.File file)
               throws HyphenationException

  Parses a hyphenation pattern file.

  Parameters:
    `file` - the pattern file
  Throws:
    `HyphenationException` - In case of an exception while parsing

### parse

    public void parse(org.xml.sax.InputSource source)
               throws HyphenationException

  Parses a hyphenation pattern file.

  Parameters:
    `source` - the InputSource for the file
  Throws:
    `HyphenationException` - In case of an exception while parsing

### 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.ArrayList normalizeException(java.util.ArrayList ex)

### getExceptionWord

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

### getInterletterValues

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

### getExternalClasses

    protected void getExternalClasses()
                               throws org.xml.sax.SAXException

  Throws:
    `org.xml.sax.SAXException`

### startElement

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

  Specified by:
    `startElement` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### 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`

### characters

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

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`

### warning

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

  Specified by:
    `warning` in interface `org.xml.sax.ErrorHandler`

### error

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

  Specified by:
    `error` in interface `org.xml.sax.ErrorHandler`

### fatalError

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

  Specified by:
    `fatalError` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`

### 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`
  Parameters:
    `c` - character group

### addException

    public void addException(java.lang.String w,
                             java.util.ArrayList 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`
  Parameters:
    `p` - the pattern
    `v` - interletter values expressed as a string of digit characters.

### setTestOut

    public void setTestOut(java.io.PrintStream testOut)

  Parameters:
    `testOut` - the testOut to set

### closeTestOut

    public void closeTestOut()

### main

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

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.