net.ontopia.xml
Class SAXTracker

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by net.ontopia.xml.SAXTracker
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
ActionConfigContentHandler, NavigatorConfigurationContentHandler, PluginContentHandler, RelationMapping

public abstract class SAXTracker
extends org.xml.sax.helpers.DefaultHandler

INTERNAL: A helper base class for SAX applications that makes it much easier to write SAX applications, since it helps applications keep track of the element stack and preserve the contents of various elements.


Field Summary
protected  java.lang.StringBuffer content
          The contents of the current element, or null if not instructed to keep the contents of the current element.
protected  java.util.Set keepContentsOf
           
protected  org.xml.sax.Locator locator
           
protected  java.util.Stack openElements
          The stack of currently open elements.
 
Constructor Summary
SAXTracker()
           
 
Method Summary
 void characters(char[] chars, int start, int length)
           
 void endElement(java.lang.String nsuri, java.lang.String lname, java.lang.String qname)
           
 boolean isParent(java.lang.String localName)
          INTERNAL: Returns true if the parent element has the given name.
 void keepContentsOf(java.lang.String elementName)
          INTERNAL: Instructs the tracker to keep the contents of all elements with the given name.
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void startElement(java.lang.String nsuri, java.lang.String lname, java.lang.String qname, org.xml.sax.Attributes attrs)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keepContentsOf

protected java.util.Set keepContentsOf

locator

protected org.xml.sax.Locator locator

content

protected java.lang.StringBuffer content
The contents of the current element, or null if not instructed to keep the contents of the current element.


openElements

protected java.util.Stack openElements
The stack of currently open elements.

Constructor Detail

SAXTracker

public SAXTracker()
Method Detail

keepContentsOf

public void keepContentsOf(java.lang.String elementName)
INTERNAL: Instructs the tracker to keep the contents of all elements with the given name.


isParent

public boolean isParent(java.lang.String localName)
INTERNAL: Returns true if the parent element has the given name.


startElement

public void startElement(java.lang.String nsuri,
                         java.lang.String lname,
                         java.lang.String qname,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] chars,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

endElement

public void endElement(java.lang.String nsuri,
                       java.lang.String lname,
                       java.lang.String qname)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler


Copyright © 2000-2012 Ontopia.