org.castor.xmlctf.xmldiff.xml
Class XMLContentHandler

java.lang.Object
  extended by org.castor.xmlctf.xmldiff.xml.XMLContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler

public class XMLContentHandler
extends java.lang.Object
implements org.xml.sax.ContentHandler

A ContentHandler implementation that builds a tree of XMLNodes.

Since:
Castor 1.1
Version:
$Revision: 0000 $ $Date: 2007-01-11 00:00:00 -0600 (Thu, 11 Jan 2007) $
Author:
Edward Kuns

Constructor Summary
XMLContentHandler()
          Creates a new XMLBuilder.
 
Method Summary
 void characters(char[] chars, int start, int length)
          Creates a new text node from incoming characters.
 void endDocument()
          Signals the end of the document.
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
          Signals the end of an Element.
 void endPrefixMapping(java.lang.String prefix)
          Signals the end of prefix mapping.
 Root getRoot()
          Returns the Root node.
 void ignorableWhitespace(char[] chars, int start, int length)
          Ignores ignorable whitespace.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Creates a new Processing Instruction node.
 void setDocumentLocator(org.xml.sax.Locator locator)
          Configures the Locator we will use.
 void skippedEntity(java.lang.String name)
          Gives notification about a skipped Entity during XML parsing.
 void startDocument()
          Signals the beginning of the document.
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
          Signals the beginning of an Element node.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Begins the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLContentHandler

public XMLContentHandler()
Creates a new XMLBuilder.

Method Detail

characters

public void characters(char[] chars,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Creates a new text node from incoming characters.

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
chars - The character array containing the XML content
start - First index of character for our new Text node
length - count of characters for our Text node.
Throws:
org.xml.sax.SAXException - never

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Signals the end of the document.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException - never

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Signals the end of an Element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
uri - The namespace URI
name - the local name of the element.
qName - the qualified naem of the element
Throws:
org.xml.sax.SAXException - if we have a mismatched end element tag

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Signals the end of prefix mapping.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - The namespace prefix mapping that is ending
Throws:
org.xml.sax.SAXException - never

getRoot

public Root getRoot()
Returns the Root node.

Returns:
the root node.

ignorableWhitespace

public void ignorableWhitespace(char[] chars,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Ignores ignorable whitespace.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Parameters:
chars - The character array containing the XML content
start - First index of the ignorable whitespace
length - count of characters for the ignorable whitespace
Throws:
org.xml.sax.SAXException - never

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Creates a new Processing Instruction node.

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Parameters:
target - the target of the processing instruction
data - the content of the processing instruction
Throws:
org.xml.sax.SAXException - never

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Configures the Locator we will use.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator - the Locator used by this DocumentHandler.

skippedEntity

public void skippedEntity(java.lang.String name)
Gives notification about a skipped Entity during XML parsing.

Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Parameters:
name - the name of the skipped entity.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Signals the beginning of the document.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException - never

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Signals the beginning of an Element node.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
uri - The namespace URI
name - the local name of the element.
qName - the qualified naem of the element
atts - a list of attributes for this Element
Throws:
org.xml.sax.SAXException - If we are not given an element name.

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
Begins the scope of a prefix-URI Namespace mapping.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - The namespace prefix mapping that is ending
uri - The namespace URI
Throws:
org.xml.sax.SAXException - never


Copyright © 2011. All Rights Reserved.