Class DictFormatter

java.lang.Object
  |
  +--DictFormatter

public class DictFormatter
extends java.lang.Object

Formats dictionary entries. XHTML (more or less) from a server-side script is parsed with a homegrown "XML parser." For performance reasons, SAX is not used. (The parser must process the DTD. Furthermore, invalid XML doesn't bust things.) Converted HTML is made available via a Reader.

Version:
$2006-08-23 23:35:54 mdh$
Author:
Malcolm D. Hyman

Constructor Summary
DictFormatter(java.lang.String location)
           
 
Method Summary
 void characters(java.lang.String chars)
           
 void endElement(java.lang.String qName)
           
 java.io.Reader getReader()
          Returns a Reader that supplies the converted HTML presentation form of a dictionary entry.
 void parseDictEntry(java.lang.String location)
          Parses the dictionary entry content.
 void startElement(java.lang.String raw)
           
 char superscript(char c)
          Returns the Unicode superscript numeral corresponding to the ASCII digit c.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictFormatter

public DictFormatter(java.lang.String location)
              throws java.io.FileNotFoundException
Method Detail

superscript

public char superscript(char c)
Returns the Unicode superscript numeral corresponding to the ASCII digit c. Behavior is undefined if c is not an ASCII digit.
Parameters:
c - ASCII digit ('0' .. '9')
Returns:
superscript digit

startElement

public void startElement(java.lang.String raw)

endElement

public void endElement(java.lang.String qName)

characters

public void characters(java.lang.String chars)

parseDictEntry

public void parseDictEntry(java.lang.String location)
                    throws java.io.FileNotFoundException
Parses the dictionary entry content.
Parameters:
location - dictionary entry URL

getReader

public java.io.Reader getReader()
Returns a Reader that supplies the converted HTML presentation form of a dictionary entry.
Returns:
Reader for converted HTML