Package com.icl.saxon
Class DOMDriver
- java.lang.Object
-
- com.icl.saxon.DOMDriver
-
- All Implemented Interfaces:
org.xml.sax.Locator,org.xml.sax.XMLReader
- Direct Known Subclasses:
TreeDriver
public class DOMDriver extends java.lang.Object implements org.xml.sax.Locator, org.xml.sax.XMLReaderDOMDriver.java: (pseudo-)SAX driver for DOM.
This class simulates the action of a SAX Parser, taking an already-constructed DOM Document and walking around it in a depth-first traversal, calling a SAX-compliant ContentHandler to process the children as it does so.- Version:
- 20 Jan 1999 modified to use AttributeListWrapper class, 3 February 2000 modified to use AttributeCollection class, 24 February 2000 modified to drive SAX2, which means it has to do namespace handling
- Author:
- MHK, 5 Jun 1998
-
-
Field Summary
Fields Modifier and Type Field Description protected org.xml.sax.ContentHandlercontentHandler(package private) static java.lang.StringFEATURE(package private) static java.lang.StringHANDLERprotected org.w3c.dom.Noderootprotected java.lang.StringsystemId
-
Constructor Summary
Constructors Constructor Description DOMDriver()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetColumnNumber()org.xml.sax.ContentHandlergetContentHandler()org.xml.sax.DTDHandlergetDTDHandler()SAX2: Returns the object used to process declarations related to notations and unparsed entities.org.xml.sax.EntityResolvergetEntityResolver()SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).org.xml.sax.ErrorHandlergetErrorHandler()SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;booleangetFeature(java.lang.String featureId)SAX2: Tells the value of the specified feature flag.intgetLineNumber()java.lang.ObjectgetProperty(java.lang.String name)SAX2: Returns the specified property.java.lang.StringgetPublicId()java.lang.StringgetSystemId()voidparse()Walk a document (traversing the nodes depth first)voidparse(java.lang.String source)Parse from SystemId.voidparse(org.xml.sax.InputSource source)Parse from InputSource.voidsetContentHandler(org.xml.sax.ContentHandler handler)Set the content handler.voidsetDocumentHandler(org.xml.sax.DocumentHandler handler)Deprecated.SAX2 programs should use the XMLReader interface and a ContentHandler.voidsetDTDHandler(org.xml.sax.DTDHandler handler)SAX1, SAX2: Set the DTD handler for this parser.voidsetEntityResolver(org.xml.sax.EntityResolver resolver)SAX1, SAX2: Set the entity resolver for this parser.voidsetErrorHandler(org.xml.sax.ErrorHandler handler)SAX1, SAX2: Set the error handler for this parser.voidsetFeature(java.lang.String featureId, boolean on)SAX2: Sets the state of feature flags in this parser.voidsetLocale(java.util.Locale locale)SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.voidsetProperty(java.lang.String propertyId, java.lang.Object property)SAX2: Assigns the specified property.voidsetStartNode(org.w3c.dom.Node start)Set the DOM Document that will be walkedvoidsetSystemId(java.lang.String systemId)
-
-
-
Field Detail
-
contentHandler
protected org.xml.sax.ContentHandler contentHandler
-
root
protected org.w3c.dom.Node root
-
systemId
protected java.lang.String systemId
-
FEATURE
static final java.lang.String FEATURE
- See Also:
- Constant Field Values
-
HANDLER
static final java.lang.String HANDLER
- See Also:
- Constant Field Values
-
-
Method Detail
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
Set the content handler.- Specified by:
setContentHandlerin interfaceorg.xml.sax.XMLReader- Parameters:
handler- The object to receive content events. If this also implements LexicalHandler, it will also be notified of comments.
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
- Specified by:
getContentHandlerin interfaceorg.xml.sax.XMLReader
-
setLocale
public void setLocale(java.util.Locale locale) throws org.xml.sax.SAXExceptionSAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.- Parameters:
locale- The locale for which diagnostics will be generated- Throws:
org.xml.sax.SAXException
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).- Specified by:
getEntityResolverin interfaceorg.xml.sax.XMLReader
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.- Specified by:
setEntityResolverin interfaceorg.xml.sax.XMLReader- Parameters:
resolver- The object to receive entity events.
-
getDTDHandler
public org.xml.sax.DTDHandler getDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities.- Specified by:
getDTDHandlerin interfaceorg.xml.sax.XMLReader
-
setDTDHandler
public void setDTDHandler(org.xml.sax.DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.- Specified by:
setDTDHandlerin interfaceorg.xml.sax.XMLReader- Parameters:
handler- The object to receive DTD events.
-
setDocumentHandler
public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
Deprecated.SAX2 programs should use the XMLReader interface and a ContentHandler.SAX1: Set the document handler for this parser. If a content handler was set, this document handler will supplant it. The parser is set to report all XML 1.0 names rather than to filter out "xmlns" attributes (the "namespace-prefixes" feature is set to true).- Parameters:
handler- The object to receive document events.
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.- Specified by:
setErrorHandlerin interfaceorg.xml.sax.XMLReader- Parameters:
handler- The object to receive error events.
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;- Specified by:
getErrorHandlerin interfaceorg.xml.sax.XMLReader
-
setStartNode
public void setStartNode(org.w3c.dom.Node start)
Set the DOM Document that will be walked
-
parse
public void parse(org.xml.sax.InputSource source) throws org.xml.sax.SAXExceptionParse from InputSource. The InputSource is ignored; it's there only to satisfy the XMLReader interface- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXException
-
parse
public void parse(java.lang.String source) throws org.xml.sax.SAXExceptionParse from SystemId. The SystemId is ignored; it's there only to satisfy the XMLReader interface- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXException
-
parse
public void parse() throws org.xml.sax.SAXExceptionWalk a document (traversing the nodes depth first)- Throws:
org.xml.sax.SAXException- On any error in the document
-
setSystemId
public void setSystemId(java.lang.String systemId)
-
getPublicId
public java.lang.String getPublicId()
- Specified by:
getPublicIdin interfaceorg.xml.sax.Locator
-
getSystemId
public java.lang.String getSystemId()
- Specified by:
getSystemIdin interfaceorg.xml.sax.Locator
-
getLineNumber
public int getLineNumber()
- Specified by:
getLineNumberin interfaceorg.xml.sax.Locator
-
getColumnNumber
public int getColumnNumber()
- Specified by:
getColumnNumberin interfaceorg.xml.sax.Locator
-
getFeature
public boolean getFeature(java.lang.String featureId) throws org.xml.sax.SAXNotRecognizedExceptionSAX2: Tells the value of the specified feature flag.- Specified by:
getFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedException- thrown if the feature flag is neither built in, nor yet assigned.
-
getProperty
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedExceptionSAX2: Returns the specified property.- Specified by:
getPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedException- thrown if the property value is neither built in, nor yet stored.
-
setFeature
public void setFeature(java.lang.String featureId, boolean on) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSAX2: Sets the state of feature flags in this parser. Some built-in feature flags are mutable; all flags not built-in are motable.- Specified by:
setFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
setProperty
public void setProperty(java.lang.String propertyId, java.lang.Object property) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSAX2: Assigns the specified property. Like SAX1 handlers, these may be changed at any time.- Specified by:
setPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
-