com.icl.saxon

Class DOMDriver

Implemented Interfaces:
Locator, XMLReader
Known Direct Subclasses:
TreeDriver

public class DOMDriver
extends Object
implements Locator, XMLReader

DOMDriver.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

(package private) static String
FEATURE
(package private) static String
HANDLER
protected ContentHandler
contentHandler
protected Node
root
protected String
systemId

Method Summary

int
getColumnNumber()
ContentHandler
getContentHandler()
DTDHandler
getDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities.
EntityResolver
getEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).
ErrorHandler
getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;
boolean
getFeature(String featureId)
SAX2: Tells the value of the specified feature flag.
int
getLineNumber()
Object
getProperty(String name)
SAX2: Returns the specified property.
String
getPublicId()
String
getSystemId()
void
parse()
Walk a document (traversing the nodes depth first)
void
parse(InputSource source)
Parse from InputSource.
void
parse(String source)
Parse from SystemId.
void
setContentHandler(ContentHandler handler)
Set the content handler.
void
setDTDHandler(DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.
void
setDocumentHandler(DocumentHandler handler)
Deprecated. SAX2 programs should use the XMLReader interface and a ContentHandler.
void
setEntityResolver(EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.
void
setErrorHandler(ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.
void
setFeature(String featureId, boolean on)
SAX2: Sets the state of feature flags in this parser.
void
setLocale(Locale locale)
SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.
void
setProperty(String propertyId, Object property)
SAX2: Assigns the specified property.
void
setStartNode(Node start)
Set the DOM Document that will be walked
void
setSystemId(String systemId)

Field Details

FEATURE

(package private) static final String FEATURE

HANDLER

(package private) static final String HANDLER

contentHandler

protected ContentHandler contentHandler

root

protected Node root

systemId

protected String systemId

Method Details

getColumnNumber

public int getColumnNumber()

getContentHandler

public ContentHandler getContentHandler()

getDTDHandler

public DTDHandler getDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities.

getEntityResolver

public EntityResolver getEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).

getErrorHandler

public ErrorHandler getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;

getFeature

public boolean getFeature(String featureId)
            throws SAXNotRecognizedException
SAX2: Tells the value of the specified feature flag.

getLineNumber

public int getLineNumber()

getProperty

public Object getProperty(String name)
            throws SAXNotRecognizedException
SAX2: Returns the specified property.

getPublicId

public String getPublicId()

getSystemId

public String getSystemId()

parse

public void parse()
            throws SAXException
Walk a document (traversing the nodes depth first)

parse

public void parse(InputSource source)
            throws SAXException
Parse from InputSource. The InputSource is ignored; it's there only to satisfy the XMLReader interface

parse

public void parse(String source)
            throws SAXException
Parse from SystemId. The SystemId is ignored; it's there only to satisfy the XMLReader interface

setContentHandler

public void setContentHandler(ContentHandler handler)
Set the content handler.
Parameters:
handler - The object to receive content events. If this also implements LexicalHandler, it will also be notified of comments.

setDTDHandler

public void setDTDHandler(DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.
Parameters:
handler - The object to receive DTD events.

setDocumentHandler

public void setDocumentHandler(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.

setEntityResolver

public void setEntityResolver(EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.
Parameters:
resolver - The object to receive entity events.

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.
Parameters:
handler - The object to receive error events.

setFeature

public void setFeature(String featureId,
                       boolean on)
            throws SAXNotRecognizedException,
                   SAXNotSupportedException
SAX2: Sets the state of feature flags in this parser. Some built-in feature flags are mutable; all flags not built-in are motable.

setLocale

public void setLocale(Locale locale)
            throws SAXException
SAX1: 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

setProperty

public void setProperty(String propertyId,
                        Object property)
            throws SAXNotRecognizedException,
                   SAXNotSupportedException
SAX2: Assigns the specified property. Like SAX1 handlers, these may be changed at any time.

setStartNode

public void setStartNode(Node start)
Set the DOM Document that will be walked

setSystemId

public void setSystemId(String systemId)