|
|||||||||
| Home >> All >> org >> objectstyle >> cayenne >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.objectstyle.cayenne.util
Class AbstractHandler

java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.objectstyle.cayenne.util.AbstractHandler
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
- public class AbstractHandler
- extends org.xml.sax.helpers.DefaultHandler
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
Previous handler for the document. |
protected org.xml.sax.XMLReader |
parser
Current parser. |
| Constructor Summary | |
AbstractHandler(org.xml.sax.XMLReader parser,
org.xml.sax.ContentHandler parentHandler)
Creates a handler and sets the parser to use it for the current element. |
|
| Method Summary | |
void |
characters(char[] buf,
int start,
int count)
Handles text within an element. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
Handles the end of an element. |
protected void |
finished()
Called when this element and all elements nested into it have been handled. |
org.xml.sax.XMLReader |
getParser()
Returns currently used XMLReader. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
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 |
parser
protected org.xml.sax.XMLReader parser
- Current parser.
parentHandler
protected org.xml.sax.ContentHandler parentHandler
- Previous handler for the document.
When the next element is finished, control returns
to this handler.
| Constructor Detail |
AbstractHandler
public AbstractHandler(org.xml.sax.XMLReader parser, org.xml.sax.ContentHandler parentHandler)
- Creates a handler and sets the parser to use it
for the current element.
| Method Detail |
getParser
public org.xml.sax.XMLReader getParser()
- Returns currently used XMLReader.
startElement
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
- Handles the start of an element. This base implementation just
throws an exception.
characters
public void characters(char[] buf,
int start,
int count)
throws org.xml.sax.SAXException
- Handles text within an element. This base implementation just
throws an exception.
finished
protected void finished()
- Called when this element and all elements nested into it have been
handled.
endElement
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
- Handles the end of an element. Any required clean-up is performed
by the finished() method and then the original handler is restored to
the parser.
|
|||||||||
| Home >> All >> org >> objectstyle >> cayenne >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC