public abstract class BaseXMLTagInterpreter extends org.xml.sax.helpers.DefaultHandler implements XMLTagInterpreter
XMLTagInterpreter
. XMLTagInterpreterController
) activates the
corresponding interpreter for each new start tag found by the SAX-parser. Constructor and Description |
---|
BaseXMLTagInterpreter()
Initializes any new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
characterData(java.lang.String data)
This method is called whenever character data is received from the parser.
|
void |
characters(char[] ch,
int start,
int length)
Is called for PCDATA between a start and end tag.
|
void |
comment(char[] ch,
int start,
int length) |
void |
endCDATA() |
void |
endDTD() |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Is called from the parser for an end tag.
|
void |
endEntity(java.lang.String name) |
protected void |
finalizeResult()
This method is called just before control is passed back to the controller.
|
protected XMLTagInterpreterController |
getParseController() |
abstract java.lang.Object |
getResult()
Returns the result object, created by this interpreter from the XML data .
|
abstract java.lang.String |
getTagName()
Returns the name of the tag, the interpreter is responsible for.
|
void |
invalidSubTagError(java.lang.String tagName)
This is a convenience method for throwing an exception, when a
an invalid sub tag is detected.
|
void |
requiredAttributeError(java.lang.String attrName)
This is a convenience method for throwing an exception, when a
a required attribute of a tag is missing.
|
abstract void |
restart(java.lang.String subTagName,
java.lang.Object subResult)
Restarts the receiver after interpretation of a sub tag.
|
void |
setController(XMLTagInterpreterController controller)
Sets the controller, the interpreter has to return control to, when finished.
|
protected void |
setParseController(XMLTagInterpreterController aValue) |
abstract void |
start(java.lang.String elementName,
org.xml.sax.Attributes attributes)
Starts the work of the receiver the first time.
|
void |
startCDATA() |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId) |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
A new sub tag was found.
|
void |
startEntity(java.lang.String name) |
protected void |
trace(java.lang.String text)
Method for debugging output.
|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
public BaseXMLTagInterpreter()
public abstract java.lang.String getTagName()
getTagName
in interface XMLTagInterpreter
public abstract void start(java.lang.String elementName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
start
in interface XMLTagInterpreter
elementName
- The name of the found element. Must be the same as getTagName().attributes
- The attributes defined in the start tag.org.xml.sax.SAXException
- If the element name is wrong or any attribute is invalid.XMLTagInterpreter.getTagName()
public abstract void restart(java.lang.String subTagName, java.lang.Object subResult) throws org.xml.sax.SAXException
restart
in interface XMLTagInterpreter
subTagName
- The name of the sub tag that was completedsubResult
- The resulting object build from the sub tag.org.xml.sax.SAXException
- If the subtag is not allowed here.public abstract java.lang.Object getResult()
public void characterData(java.lang.String data)
data
- The data received from the parser.ContentHandler.characters(char[],int,int)
public void setController(XMLTagInterpreterController controller)
setController
in interface XMLTagInterpreter
controller
- The controller of the XML interpretation process.public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
restart(String,Object)
,
ContentHandler.startElement(String,String,String,Attributes)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
This method calls finalizeResult() and then returns controll to the overall tag interpreter controller.
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The URI of the tag's namespace or null if no namespace definedlocalName
- The name of the end tag without any namespace prefix.qName
- The qualified name (might contain the namespace prefix)org.xml.sax.SAXException
ContentHandler.endElement(String,String,String)
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
characterData(String)
public void invalidSubTagError(java.lang.String tagName) throws org.xml.sax.SAXException
restart(String,Object)
.tagName
- The name of the invalid sub tag.org.xml.sax.SAXException
- Is always thrown by this method !public void requiredAttributeError(java.lang.String attrName) throws org.xml.sax.SAXException
start(String,Attributes)
.attrName
- The name of the required attribute.org.xml.sax.SAXException
- Is always thrown by this method !public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
protected void finalizeResult()
protected void trace(java.lang.String text)
protected XMLTagInterpreterController getParseController()
protected void setParseController(XMLTagInterpreterController aValue)