Class XMLContext
- java.lang.Object
-
- org.apache.manifoldcf.agents.common.XMLContext
-
- Direct Known Subclasses:
XMLStringContext
,XMLWriterContext
public class XMLContext extends java.lang.Object
An instance of this class represents a parsing context within a node. Parsing functionality is implemented by extending this class to do the right thing for the context in which it is deployed. The base functionality "does nothing"; extended functionality is needed to interpret nodes and act upon them.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
localname
The localname associated with the contextprotected java.lang.String
namespaceURI
The namespace URI associated with the contextprotected XMLContext
previousContext
The previous contextprotected java.lang.String
qname
The qname associated with the contextprotected org.xml.sax.Attributes
theseAttributes
The attributes belonging to the node associated with this contextprotected XMLStream
theStream
The stream we belong to
-
Constructor Summary
Constructors Constructor Description XMLContext(XMLStream theStream)
Root constructor.XMLContext(XMLStream theStream, java.lang.String namespaceURI, java.lang.String localname, java.lang.String qname, org.xml.sax.Attributes theseAttributes)
Full constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected XMLContext
beginTag(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
This method is meant to be extended by classes that extend this class.void
characters(char[] ch, int start, int length)
Handle content of a tagvoid
cleanup()
Cleanup this context object, and then recurse up the chain.void
endDocument()
Handle the end of the documentvoid
endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
Handle the end of a tagprotected void
endTag()
This method is meant to be extended by classes that extend this classjava.lang.String
getAttribute(java.lang.String attributeName)
Get an attribute's value, if anyjava.lang.String
getLocalname()
Get the localname of this nodejava.lang.String
getNamespaceURI()
Get the namespace URI of this nodejava.lang.String
getQname()
Get the qname of this nodevoid
startDocument()
Handle the start of the documentvoid
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
Handle the start of a tagprotected void
tagCleanup()
Override this method to be called during cleanupprotected void
tagContents(char[] ch, int start, int length)
This method is meant to be extended by classes that extend this class
-
-
-
Field Detail
-
theStream
protected XMLStream theStream
The stream we belong to
-
previousContext
protected XMLContext previousContext
The previous context
-
theseAttributes
protected org.xml.sax.Attributes theseAttributes
The attributes belonging to the node associated with this context
-
namespaceURI
protected java.lang.String namespaceURI
The namespace URI associated with the context
-
localname
protected java.lang.String localname
The localname associated with the context
-
qname
protected java.lang.String qname
The qname associated with the context
-
-
Constructor Detail
-
XMLContext
public XMLContext(XMLStream theStream)
Root constructor. Used for outer document level.
-
XMLContext
public XMLContext(XMLStream theStream, java.lang.String namespaceURI, java.lang.String localname, java.lang.String qname, org.xml.sax.Attributes theseAttributes)
Full constructor. Used for individual tags.
-
-
Method Detail
-
getAttribute
public java.lang.String getAttribute(java.lang.String attributeName)
Get an attribute's value, if any
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Get the namespace URI of this node
-
getLocalname
public java.lang.String getLocalname()
Get the localname of this node
-
getQname
public java.lang.String getQname()
Get the qname of this node
-
startDocument
public final void startDocument() throws org.xml.sax.SAXException
Handle the start of the document- Throws:
org.xml.sax.SAXException
-
endDocument
public final void endDocument() throws org.xml.sax.SAXException
Handle the end of the document- Throws:
org.xml.sax.SAXException
-
startElement
public final void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
Handle the start of a tag- Throws:
org.xml.sax.SAXException
-
endElement
public final void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
Handle the end of a tag- Throws:
org.xml.sax.SAXException
-
characters
public final void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
Handle content of a tag- Throws:
org.xml.sax.SAXException
-
cleanup
public final void cleanup() throws ManifoldCFException
Cleanup this context object, and then recurse up the chain. This method is called without fail at the end of any parse, whether it errored out or not, so that proper cleanup always happens for any tags left on the stack.- Throws:
ManifoldCFException
-
beginTag
protected XMLContext beginTag(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws ManifoldCFException, ServiceInterruption
This method is meant to be extended by classes that extend this class. The form of this method is meant to enable creation of a context object derived from XMLContext that understands how to actually handle tags and content within the current context.
-
endTag
protected void endTag() throws ManifoldCFException, ServiceInterruption
This method is meant to be extended by classes that extend this class
-
tagContents
protected void tagContents(char[] ch, int start, int length) throws ManifoldCFException, ServiceInterruption
This method is meant to be extended by classes that extend this class
-
tagCleanup
protected void tagCleanup() throws ManifoldCFException
Override this method to be called during cleanup- Throws:
ManifoldCFException
-
-