Release Planner v1.0

rp.util.xml
Class XMLLoader

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--rp.util.xml.XMLLoader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, XMLLoaderChainElement
Direct Known Subclasses:
EstimateLoader, RPLoader

public abstract class XMLLoader
extends org.xml.sax.helpers.DefaultHandler
implements XMLLoaderChainElement

The baseclass for XML loader objects.

Version:
$Revision: 1.3 $, $Date: 2002/03/02 18:53:02 $

Constructor Summary
XMLLoader()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
protected  java.lang.Object done()
          Called on the end-tag corresponding to the start tag that casued this loader to be invoked.
 void doneLoader(int tagId, java.lang.StringBuffer charData, java.lang.Object o)
          Called after the currently active loader encounters its end tag.
protected  void endElement(int tagId)
          Called when the end-tag of an element is encoutnered.
 void endElement(java.lang.String namespaceURI, java.lang.String name, java.lang.String qName)
           
protected  org.xml.sax.Attributes getAttributes()
          Return the attributes associated with the current tag
protected  java.lang.String getCharData()
          Return the character data associated with the current tag
protected  java.lang.Object getLoaderParameter()
          Fetches the parameter from the just finished loader.
protected  int getNestingLevel()
          The nesting level of the XML tags relative to this loader.
protected  java.lang.Object getParameter()
          Fetches the invocation parameter for this loader.
protected  void init()
          Called to allow the loader to do any object-specific intialization.
protected  void newLoader(java.lang.Object o)
          Establishes a new loader for the given tag as the current content handler Should be called in startElement or not at all.
protected  void startElement(int tagId)
          Called whenever a new XML element is encountered Attributes may be accessed via a call to getAttributes.
 void startElement(java.lang.String namespaceURI, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLLoader

public XMLLoader()
Method Detail

newLoader

protected final void newLoader(java.lang.Object o)
Establishes a new loader for the given tag as the current content handler Should be called in startElement or not at all.

Parameters:
o - an arbitrary parameter to pass to the new loader object

doneLoader

public final void doneLoader(int tagId,
                             java.lang.StringBuffer charData,
                             java.lang.Object o)
Description copied from interface: XMLLoaderChainElement
Called after the currently active loader encounters its end tag. Implementer is responsible for set content handler back to itself. Note that this is symmetrical in thart objects set themselves to be content handlers initially.

Specified by:
doneLoader in interface XMLLoaderChainElement
Parameters:
tagId - the integer id of the tag that just finished
charData - the character data that was read for that tag
o - arbitrary parameter to pass back to the invoking loader

init

protected void init()
Called to allow the loader to do any object-specific intialization. Attributes may be accessed via a call to getAttributes. An invocation parameter may be accessed via a call to getParameter.


startElement

protected void startElement(int tagId)
Called whenever a new XML element is encountered Attributes may be accessed via a call to getAttributes. Character data may be accessed via a call to getCharData. The loader return parameter may be accessed via a call to getLoaderParameter.


endElement

protected void endElement(int tagId)
Called when the end-tag of an element is encoutnered. Attributes may be accessed via a call to getAttributes. Character data may be accessed via a call to getCharData.


done

protected java.lang.Object done()
Called on the end-tag corresponding to the start tag that casued this loader to be invoked. Attributes may be accessed via a call to getAttributes. Character data may be accessed via a call to getCharData. An invocation parameter may be accessed via a call to getParameter.

Returns:
a parameter to return to the previous loader

getParameter

protected final java.lang.Object getParameter()
Fetches the invocation parameter for this loader.

Returns:
the invocation parameter

getLoaderParameter

protected final java.lang.Object getLoaderParameter()
Fetches the parameter from the just finished loader.

Returns:
the just finished loader parameter

getAttributes

protected final org.xml.sax.Attributes getAttributes()
Return the attributes associated with the current tag

Returns:
the attributes asosciated with the current tag

getCharData

protected final java.lang.String getCharData()
Return the character data associated with the current tag

Returns:
the character data (as a string) associated with the current tag

getNestingLevel

protected final int getNestingLevel()
The nesting level of the XML tags relative to this loader. init() and done() will see a nestingLevel of 0. startElement(int) and endElement(int) for the same element will see the same nesting level > 0.


startElement

public final void startElement(java.lang.String namespaceURI,
                               java.lang.String name,
                               java.lang.String qName,
                               org.xml.sax.Attributes atts)
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

characters

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

endElement

public final void endElement(java.lang.String namespaceURI,
                             java.lang.String name,
                             java.lang.String qName)
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

Release Planner v1.0