org.pf.pax
Interface XMLTagInterpreter

All Superinterfaces:
org.xml.sax.ContentHandler
All Known Implementing Classes:
BaseXMLTagInterpreter, XMLWriteInterpreter

public interface XMLTagInterpreter
extends org.xml.sax.ContentHandler

This defines the API for a tag interpreter class in the PAX framework.
The concept is based on the idea, that there is a corresponding tag interpreter object (implementing this interface) to each different tag of an XML document.

Version:
2.0
Author:
Manfred Duchrow
See Also:
ContentHandler

Method Summary
 java.lang.String getTagName()
          Returns the name of the tag, the interpreter is responsible for.
 void restart(java.lang.String subTagName, java.lang.Object subResult)
          Restarts the receiver after returning from interpretation of a sub tag.
 void setController(XMLTagInterpreterController controller)
          Sets the controller, the interpreter has to return control to, when finished with interpretation of its corresonding tag contents.
 void start(java.lang.String elementName, org.xml.sax.Attributes attributes)
          Starts the work of the receiver for the first time.
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 

Method Detail

getTagName

java.lang.String getTagName()
Returns the name of the tag, the interpreter is responsible for.
The tag name must be returned without brackets.
WRONG: "<Sample>"
CORRECT: "Sample"

Returns:
A string containing the name of the tag the receiver is made for.

setController

void setController(XMLTagInterpreterController controller)
Sets the controller, the interpreter has to return control to, when finished with interpretation of its corresonding tag contents.

Parameters:
controller - The controller of the XML interpretation process.

start

void start(java.lang.String elementName,
           org.xml.sax.Attributes attributes)
           throws org.xml.sax.SAXException
Starts the work of the receiver for the first time.
That means, when the parser reached the start tag corresponding to this tag interpreter. Here the business object that results from the tag's data contents should be created and initialized with the given attribute values.

Parameters:
elementName - The name of the found element. Must be the same as this.getTagName().
attributes - The attributes defined in the start tag.
Throws:
org.xml.sax.SAXException - If the element name is wrong or any attribute is invalid.
See Also:
getTagName()

restart

void restart(java.lang.String subTagName,
             java.lang.Object subResult)
             throws org.xml.sax.SAXException
Restarts the receiver after returning from interpretation of a sub tag.
By receiving the last subtag name and the resulting object of its interpretaion it is possible to plug this result-object into the right slot of the receiver's result-object.

Parameters:
subTagName - The name of the sub element to which the result belongs.
subResult - The object created from the subtag's contents.
Throws:
org.xml.sax.SAXException - If the subtag is not allowed here.