Package net.ontopia.xml
Class SAXTracker
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- net.ontopia.xml.SAXTracker
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
NavigatorConfigurationContentHandler,PluginContentHandler,RelationMapping
public abstract class SAXTracker extends DefaultHandler
INTERNAL: A helper base class for SAX applications that makes it much easier to write SAX applications, since it helps applications keep track of the element stack and preserve the contents of various elements.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringBuildercontentThe contents of the current element, or null if not instructed to keep the contents of the current element.protected Set<String>keepContentsOfprotected Locatorlocatorprotected Stack<String>openElementsThe stack of currently open elements.
-
Constructor Summary
Constructors Constructor Description SAXTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] chars, int start, int length)voidendElement(String nsuri, String lname, String qname)booleanisParent(String localName)INTERNAL: Returns true if the parent element has the given name.voidkeepContentsOf(String elementName)INTERNAL: Instructs the tracker to keep the contents of all elements with the given name.voidsetDocumentLocator(Locator locator)voidstartElement(String nsuri, String lname, String qname, Attributes attrs)-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
locator
protected Locator locator
-
content
protected StringBuilder content
The contents of the current element, or null if not instructed to keep the contents of the current element.
-
-
Method Detail
-
keepContentsOf
public void keepContentsOf(String elementName)
INTERNAL: Instructs the tracker to keep the contents of all elements with the given name.
-
isParent
public boolean isParent(String localName)
INTERNAL: Returns true if the parent element has the given name.
-
startElement
public void startElement(String nsuri, String lname, String qname, Attributes attrs) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
characters
public void characters(char[] chars, int start, int length)- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
endElement
public void endElement(String nsuri, String lname, String qname) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classDefaultHandler
-
-