Package com.icl.saxon

Class DOMDriver

  • All Implemented Interfaces:
    Locator, XMLReader
    Direct Known 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.
    • Constructor Detail

      • DOMDriver

        public DOMDriver()
    • Method Detail

      • setContentHandler

        public void setContentHandler​(ContentHandler handler)
        Set the content handler.
        Specified by:
        setContentHandler in interface XMLReader
        Parameters:
        handler - The object to receive content events. If this also implements LexicalHandler, it will also be notified of comments.
      • 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
        Throws:
        SAXException
      • getEntityResolver

        public EntityResolver getEntityResolver()
        SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).
        Specified by:
        getEntityResolver in interface XMLReader
      • setEntityResolver

        public void setEntityResolver​(EntityResolver resolver)
        SAX1, SAX2: Set the entity resolver for this parser.
        Specified by:
        setEntityResolver in interface XMLReader
        Parameters:
        resolver - The object to receive entity events.
      • getDTDHandler

        public DTDHandler getDTDHandler()
        SAX2: Returns the object used to process declarations related to notations and unparsed entities.
        Specified by:
        getDTDHandler in interface XMLReader
      • setDTDHandler

        public void setDTDHandler​(DTDHandler handler)
        SAX1, SAX2: Set the DTD handler for this parser.
        Specified by:
        setDTDHandler in interface XMLReader
        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.
      • setErrorHandler

        public void setErrorHandler​(ErrorHandler handler)
        SAX1, SAX2: Set the error handler for this parser.
        Specified by:
        setErrorHandler in interface XMLReader
        Parameters:
        handler - The object to receive error events.
      • 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;
        Specified by:
        getErrorHandler in interface XMLReader
      • setStartNode

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

        public void parse​(String source)
                   throws SAXException
        Parse from SystemId. The SystemId is ignored; it's there only to satisfy the XMLReader interface
        Specified by:
        parse in interface XMLReader
        Throws:
        SAXException
      • parse

        public void parse()
                   throws SAXException
        Walk a document (traversing the nodes depth first)
        Throws:
        SAXException - On any error in the document
      • setSystemId

        public void setSystemId​(String systemId)