public abstract class StackBasedXMLParser extends Parser
Modifier and Type | Field and Description |
---|---|
protected int |
mDepth
Count the depths of elements in the document
|
protected boolean |
mParsingDone
A boolean indicating that parsing is done.
|
protected Stack |
mStack
The stack of objects kept around.
|
DEFAULT_PARSER_NAME, mAdjFName, mLocator, mLogger, mLogMsg, mParser, mProps, mTextContent, mTextString
Constructor and Description |
---|
StackBasedXMLParser(PegasusBag bag)
The overloaded constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeNotSupported(String element,
String attribute,
String value)
This is called when an attribute is encountered for an element that is valid
in the schema context but not supported right now.
|
void |
complain(String element,
String attribute,
String value)
This is called when an attribute is encountered for an element that is invalid
from the schema context and is not supported.
|
abstract Object |
createObject(String element,
List names,
List values)
Composes the
SiteData object corresponding to the element
name in the XML document. |
void |
endDocument()
This is called automatically when the end of the XML file is reached.
|
void |
endElement(String namespaceURI,
String localName,
String qName)
The parser is at the end of an element.
|
void |
log(String element,
String attribute,
String value) |
abstract boolean |
setElementRelation(String childElement,
Object parent,
Object child)
This method sets the relations between the currently finished XML
element(child) and its containing element in terms of Java objects.
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
This method defines the action to take when the parser begins to parse
an element.
|
void |
unSupportedNestingOfElements(String parent,
String child)
Called when certain element nesting is allowed in the XML schema
but is not supported in the code as yet.
|
characters, getSchemaLocation, getSchemaNamespace, ignoreWhitespace, ignoreWhitespace, setDocumentLocator, setParserFeature, setSchemaLocations, startParser, testForFile
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
protected int mDepth
protected Stack mStack
protected boolean mParsingDone
public StackBasedXMLParser(PegasusBag bag)
bag
- the PegasusBag
to be used.public abstract Object createObject(String element, List names, List values)
SiteData
object corresponding to the element
name in the XML document.element
- the element name encountered while parsing.names
- is a list of attribute names, as strings.values
- is a list of attribute values, to match the key list.IllegalArgumentException
- if the element name is too short.public abstract boolean setElementRelation(String childElement, Object parent, Object child)
childElement
- name is the the child element nameparent
- is a reference to the parent's Java objectchild
- is the completed child object to connect to the parentpublic void endDocument()
Parser
endDocument
in interface ContentHandler
endDocument
in class Parser
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class Parser
namespaceURI
- is the URI of the namespace for the elementlocalName
- is the element name without namespaceqName
- is the element name as it appears in the docmentatts
- has the names and values of all the attributesSAXException
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class Parser
namespaceURI
- is the URI of the namespace for the elementlocalName
- is the element name without namespaceqName
- is the element name as it appears in the docmentSAXException
public void log(String element, String attribute, String value)
element
- attribute
- value
- public void complain(String element, String attribute, String value)
element
- the element nameattribute
- the attribute namevalue
- the attribute valuepublic void attributeNotSupported(String element, String attribute, String value)
element
- the element nameattribute
- the attribute namevalue
- the attribute value