Class XMLContentHandler

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

public class XMLContentHandler extends Object implements 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 Details

    • XMLContentHandler

      public XMLContentHandler()
      Creates a new XMLBuilder.
  • Method Details

    • characters

      public void characters(char[] chars, int start, int length) throws SAXException
      Creates a new text node from incoming characters.
      Specified by:
      characters in interface 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:
      SAXException - never
    • endDocument

      public void endDocument() throws SAXException
      Signals the end of the document.
      Specified by:
      endDocument in interface ContentHandler
      Throws:
      SAXException - never
    • endElement

      public void endElement(String uri, String name, String qName) throws SAXException
      Signals the end of an Element.
      Specified by:
      endElement in interface ContentHandler
      Parameters:
      uri - The namespace URI
      name - the local name of the element.
      qName - the qualified naem of the element
      Throws:
      SAXException - if we have a mismatched end element tag
    • endPrefixMapping

      public void endPrefixMapping(String prefix) throws SAXException
      Signals the end of prefix mapping.
      Specified by:
      endPrefixMapping in interface ContentHandler
      Parameters:
      prefix - The namespace prefix mapping that is ending
      Throws:
      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 SAXException
      Ignores ignorable whitespace.
      Specified by:
      ignorableWhitespace in interface 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:
      SAXException - never
    • processingInstruction

      public void processingInstruction(String target, String data) throws SAXException
      Creates a new Processing Instruction node.
      Specified by:
      processingInstruction in interface ContentHandler
      Parameters:
      target - the target of the processing instruction
      data - the content of the processing instruction
      Throws:
      SAXException - never
    • setDocumentLocator

      public void setDocumentLocator(Locator locator)
      Configures the Locator we will use.
      Specified by:
      setDocumentLocator in interface ContentHandler
      Parameters:
      locator - the Locator used by this DocumentHandler.
    • skippedEntity

      public void skippedEntity(String name)
      Gives notification about a skipped Entity during XML parsing.
      Specified by:
      skippedEntity in interface ContentHandler
      Parameters:
      name - the name of the skipped entity.
    • startDocument

      public void startDocument() throws SAXException
      Signals the beginning of the document.
      Specified by:
      startDocument in interface ContentHandler
      Throws:
      SAXException - never
    • startElement

      public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException
      Signals the beginning of an Element node.
      Specified by:
      startElement in interface 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:
      SAXException - If we are not given an element name.
    • startPrefixMapping

      public void startPrefixMapping(String prefix, String uri)
      Begins the scope of a prefix-URI Namespace mapping.
      Specified by:
      startPrefixMapping in interface ContentHandler
      Parameters:
      prefix - The namespace prefix mapping that is ending
      uri - The namespace URI
      Throws:
      SAXException - never