org.menagery.dtd
Class Parser

java.lang.Object
  |
  +--org.menagery.dtd.Parser

public class Parser
extends java.lang.Object

Non-threaded DTD reader and parser. Creates a DTD tree.


Constructor Summary
Parser()
           
 
Method Summary
static Element getElement(java.lang.String sLine)
          Retrieves a complete element definition from the DTD file.
static void main(java.lang.String[] args)
          Unit test.
static DTD parse(java.io.File fileDTD)
          Given a file reference, parses the file and creates a DTD tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

parse

public static DTD parse(java.io.File fileDTD)
                 throws java.io.IOException,
                        java.io.FileNotFoundException
Given a file reference, parses the file and creates a DTD tree.
Parameters:
fileDTD - The file referenceccontaining the DTD to be parsed
Returns:
The DTD tree, null if it was an unreadable DTD.
Throws:
java.io.IOException -  
java.io.FileNotFoundException -  

getElement

public static Element getElement(java.lang.String sLine)
                          throws java.io.IOException
Retrieves a complete element definition from the DTD file. If the element is incomplete or malformed, it will skip the definition and return null instead.
Parameters:
sLine - The line containing the start of the element definition.
br - The BufferedReader holding open the DTD file, in case the definition spans lines.
Returns:
An Element object containing the DTD element, or null if the element was malformed.
Throws:
java.io.IOException -  

main

public static void main(java.lang.String[] args)
Unit test.