uk.co.demon.ursus.dom
Class SAXDOMBuilder

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--uk.co.demon.ursus.dom.SAXAdapter
              |
              +--uk.co.demon.ursus.dom.SAXDOMBuilder
Direct Known Subclasses:
CMLDOMSAXBuilderImpl

public class SAXDOMBuilder
extends SAXAdapter

Builds a DOM from SAX events


Field Summary
protected  org.w3c.dom.Node currentNode
           
protected  PMRDocument document
           
protected  java.util.Stack stack
           
protected  boolean start
           
 
Fields inherited from class uk.co.demon.ursus.dom.SAXAdapter
AELFRED, defaultParserClassName, defaultParserType, DXP, LARK, MSXML, nParserTypes, parser, parserTypeStrings, reader, urlString, XERCESNV, XERCESSAX, XML4J, XP
 
Constructor Summary
SAXDOMBuilder()
          create with default parser
SAXDOMBuilder(org.xml.sax.Parser parser)
           
SAXDOMBuilder(java.lang.String parserClassName)
          create a new SAXDOMBuilder with given parserName
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data inside an element.
 void endDocument()
          Receive notification of the end of the document.
 void endElement(java.lang.String name)
          Receive notification of the end of an element.
 PMRDocument getDocument()
           
static void main(java.lang.String[] args)
          Main entry point for an application.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 void startDocument()
          Receive notification of the beginning of the document.
 void startElement(java.lang.String name, org.xml.sax.AttributeList attributes)
          Receive notification of the start of an element.
 
Methods inherited from class uk.co.demon.ursus.dom.SAXAdapter
addAttributes, attributeString, elementCounter, error, fatalError, getErrorMessage, ignorableWhitespace, notationDecl, parse, parse, parse, resolveEntity, setDocumentLocator, setParser, setParser, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected PMRDocument document

currentNode

protected org.w3c.dom.Node currentNode

stack

protected java.util.Stack stack

start

protected boolean start
Constructor Detail

SAXDOMBuilder

public SAXDOMBuilder()
create with default parser

SAXDOMBuilder

public SAXDOMBuilder(java.lang.String parserClassName)
              throws java.lang.Exception
create a new SAXDOMBuilder with given parserName
Parameters:
String - parserClassName full clas name of parser
Throws:
XException - IO problems or parsing errors

SAXDOMBuilder

public SAXDOMBuilder(org.xml.sax.Parser parser)
              throws java.lang.Exception
Method Detail

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Description copied from class: SAXAdapter
Receive notification of the beginning of the document. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).
Overrides:
startDocument in class SAXAdapter
Throws:
org.xml.sax.SAXException - IO problems or parsing errors

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Description copied from class: SAXAdapter
Receive notification of the end of the document. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as finalising a tree or closing an output file).
Overrides:
endDocument in class SAXAdapter
Throws:
org.xml.sax.SAXException - IO problems or parsing errors

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList attributes)
                  throws org.xml.sax.SAXException
Description copied from class: SAXAdapter
Receive notification of the start of an element. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).
Overrides:
startElement in class SAXAdapter
Parameters:
name - The element type name.
attributes - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - IO problems or parsing errors
See Also:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Description copied from class: SAXAdapter
Receive notification of the end of an element. By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).
Overrides:
endElement in class SAXAdapter
Parameters:
name - The element type name.
attributes - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - IO problems or parsing errors
See Also:
DocumentHandler.endElement(java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Description copied from class: SAXAdapter
Receive notification of character data inside an element. By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).
Overrides:
characters in class SAXAdapter
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
org.xml.sax.SAXException - IO problems or parsing errors
See Also:
DocumentHandler.characters(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Description copied from class: SAXAdapter
Receive notification of a processing instruction. By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.
Overrides:
processingInstruction in class SAXAdapter
Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none is supplied.
Throws:
org.xml.sax.SAXException - IO problems or parsing errors
See Also:
DocumentHandler.processingInstruction(java.lang.String, java.lang.String)

getDocument

public PMRDocument getDocument()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main entry point for an application.
Throws:
java.lang.Exception - almost anything in the galaxy could go wrong