Class SAXNestedTagHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.apache.cayenne.configuration.xml.SAXNestedTagHandler
- All Implemented Interfaces:
- ContentHandler,- DTDHandler,- EntityResolver,- ErrorHandler
- Direct Known Subclasses:
- NamespaceAwareNestedTagHandler
public class SAXNestedTagHandler extends DefaultHandler
A superclass of nested tag handlers for parsing of XML documents with SAX.
 This class is not namespace aware, i.e. tags like <info:property/> and <property/>
 will be treated as equal.
 Use 
NamespaceAwareNestedTagHandler if you need to process namespaces.- Since:
- 3.1, 4.1 redesigned and moved from org.apache.cayenne.configurationpackage
- See Also:
- NamespaceAwareNestedTagHandler
- 
Field SummaryFields Modifier and Type Field Description protected LoaderContextloaderContextprotected Locatorlocatorprotected ContentHandlerparentHandler
- 
Constructor SummaryConstructors Constructor Description SAXNestedTagHandler(LoaderContext loaderContext)SAXNestedTagHandler(SAXNestedTagHandler parentHandler)
- 
Method SummaryModifier and Type Method Description protected voidbeforeScopeEnd()Callback method that is called before this handler pushed out of parsers stack.protected ContentHandlercreateChildTagHandler(String namespaceURI, String localName, String qName, Attributes attributes)This method should be used to create nested handlers to process children elements.voidendElement(String namespaceURI, String localName, String qName)ContentHandlergetParentHandler()protected booleanprocessElement(String namespaceURI, String localName, Attributes attributes)Main method to process XML content.voidsetDocumentLocator(Locator locator)voidstartElement(String namespaceURI, String localName, String qName, Attributes attributes)This method directly called by SAX parser, do not override it directly, useprocessElement(String, String, Attributes)method instead to process content.protected voidstop()protected StringunexpectedTagMessage(String tagFound, String... tagsExpected)Methods inherited from class org.xml.sax.helpers.DefaultHandlercharacters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandlerdeclaration
- 
Field Details- 
loaderContext
- 
parentHandler
- 
locator
 
- 
- 
Constructor Details- 
SAXNestedTagHandler
- 
SAXNestedTagHandler
 
- 
- 
Method Details- 
unexpectedTagMessage
- 
processElementprotected boolean processElement(String namespaceURI, String localName, Attributes attributes) throws SAXExceptionMain method to process XML content. Should be override in subclasses, by default do nothing. Return value should be true if tag was fully processed and shouldn't be passed down to child handler.- Parameters:
- namespaceURI- namespace for tag
- localName- tag local name (i.e. w/o namespace prefix)
- attributes- tag attributes
- Returns:
- true if tag was processed
- Throws:
- SAXException- can be thrown to abort parsing
- See Also:
- createChildTagHandler(String, String, String, Attributes)
 
- 
beforeScopeEndprotected void beforeScopeEnd()Callback method that is called before this handler pushed out of parsers stack. Can be used to flush some aggregate state.
- 
createChildTagHandlerprotected ContentHandler createChildTagHandler(String namespaceURI, String localName, String qName, Attributes attributes)This method should be used to create nested handlers to process children elements. This method should never returnnull.- Parameters:
- namespaceURI- namespace for tag
- localName- tag local name (i.e. w/o namespace prefix)
- qName- tag full name (i.e. with namespace prefix)
- attributes- tag attributes
- Returns:
- new handler to process child tag
 
- 
stopprotected void stop()
- 
startElementpublic void startElement(String namespaceURI, String localName, String qName, Attributes attributes) throws SAXExceptionThis method directly called by SAX parser, do not override it directly, useprocessElement(String, String, Attributes)method instead to process content.- Specified by:
- startElementin interface- ContentHandler
- Overrides:
- startElementin class- DefaultHandler
- Throws:
- SAXException
- See Also:
- createChildTagHandler(String, String, String, Attributes)
 
- 
endElement- Specified by:
- endElementin interface- ContentHandler
- Overrides:
- endElementin class- DefaultHandler
- Throws:
- SAXException
 
- 
setDocumentLocator- Specified by:
- setDocumentLocatorin interface- ContentHandler
- Overrides:
- setDocumentLocatorin class- DefaultHandler
 
- 
getParentHandler
 
-