byucc.jhdl.util.xmac
Class DocumentMaker

java.lang.Object
  extended byorg.xml.sax.HandlerBase
      extended bybyucc.jhdl.util.xmac.DocumentMaker
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class DocumentMaker
extends org.xml.sax.HandlerBase

This class creates a DOM document from an input XML file. Upon creation the document has all empty text nodes removed so the rest of the parser doesn't have to deal with them.

Author:
Isaac E. Wagner

Field Summary
 java.lang.StringBuffer result
          This StringBuffer contains the results of the parse operation.
 
Constructor Summary
DocumentMaker()
           
 
Method Summary
 void error(org.xml.sax.SAXParseException ex)
          Error.
 void fatalError(org.xml.sax.SAXParseException ex)
          Fatal error.
static org.w3c.dom.Document parseDOM(java.lang.String filename)
          This method parses a file and returns a DOM document representation of that file.
static org.w3c.dom.Document parseDOM(java.lang.String filename, boolean validate)
          This method parses a file and returns a DOM document representation of that file.
 void warning(org.xml.sax.SAXParseException ex)
          Warning.
 
Methods inherited from class org.xml.sax.HandlerBase
characters, endDocument, endElement, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, startElement, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

result

public java.lang.StringBuffer result
This StringBuffer contains the results of the parse operation. Note that although this field is public it should never be used by the public. It exists becuase DocumenMaker makes an instance of itself and grabs the results from this buffer. Otherwise it's not set.

Constructor Detail

DocumentMaker

public DocumentMaker()
Method Detail

parseDOM

public static org.w3c.dom.Document parseDOM(java.lang.String filename)
                                     throws java.lang.Exception
This method parses a file and returns a DOM document representation of that file. By default this method does not validate the input file against a schema.

Parameters:
filename - A String representing the filename to parse.
Returns:
On success this method returns a DOM Document object.
Throws:
java.lang.Exception

parseDOM

public static org.w3c.dom.Document parseDOM(java.lang.String filename,
                                            boolean validate)
                                     throws java.lang.Exception
This method parses a file and returns a DOM document representation of that file. This method can validate the document against a schema.

Parameters:
filename - A String representing the filename to parse.
validate - True if the parser is to validate the input document, false otherwise.
Returns:
On success this method returns a DOM Document object.
Throws:
java.lang.Exception

warning

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


error

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


fatalError

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

Throws:
org.xml.sax.SAXException


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.