|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.apache.cayenne.util.AbstractHandler
public class AbstractHandler
The common superclass for all SAX event handlers used to parse the configuration file. Each method just throws an exception, so subclasses should override what they can handle. Each type of XML element (map, node, etc.) has a specific subclass. In the constructor, this class takes over the handling of SAX events from the parent handler and returns control back to the parent in the endElement method.
The idea to use nested handlers for XML document parsing (and code to implement it) were taken from org.apache.tools.ant.ProjectHelper from Jakarta-Ant project (Copyright: Apache Software Foundation). This may not be the best way to build objects from XML, but it is rather consistent. For each nested element in the XML tree a dedicated handler is created (subclass of this AbstractHandler). Once the element is parsed, control is handled back to the parent handler.
Field Summary | |
---|---|
protected org.xml.sax.ContentHandler |
parentHandler
Deprecated. Previous handler for the document. |
protected org.xml.sax.XMLReader |
parser
Deprecated. Current parser. |
Constructor Summary | |
---|---|
AbstractHandler(org.xml.sax.XMLReader parser,
org.xml.sax.ContentHandler parentHandler)
Deprecated. Creates a handler and sets the parser to use it for the current element. |
Method Summary | |
---|---|
void |
characters(char[] buf,
int start,
int count)
Deprecated. Handles text within an element. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
Deprecated. Handles the end of an element. |
protected void |
finished()
Deprecated. Called when this element and all elements nested into it have been handled. |
org.xml.sax.XMLReader |
getParser()
Deprecated. Returns currently used XMLReader. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
Deprecated. Handles the start of an element. |
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 |
Field Detail |
---|
protected org.xml.sax.XMLReader parser
protected org.xml.sax.ContentHandler parentHandler
Constructor Detail |
---|
public AbstractHandler(org.xml.sax.XMLReader parser, org.xml.sax.ContentHandler parentHandler)
parser
- Currently used XML parser. Must not be null
.parentHandler
- The handler which should be restored to the parser at the end
of the element. Must not be null
.Method Detail |
---|
public org.xml.sax.XMLReader getParser()
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- if this method is not overridden, or in case of error in an
overridden versionpublic void characters(char[] buf, int start, int count) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
buf
- A character array of the text within the element. Will not be
null
.start
- The start element in the array.count
- The number of characters to read from the array.
org.xml.sax.SAXException
- if this method is not overridden, or in case of error in an
overridden versionprotected void finished()
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
finished()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |