Class DOMReader

    • Method Detail

      • write

        public void write​(Node node)
                   throws SAXException
        A polymorphic method to write any Node to this SAX stream
        Parameters:
        node - DOCUMENT ME!
        Throws:
        SAXException - DOCUMENT ME!
      • write

        public void write​(Document document)
                   throws SAXException
        Generates SAX events for the given Document and all its content
        Parameters:
        document - is the Document to parse
        Throws:
        SAXException - if there is a SAX error processing the events
      • write

        public void write​(Element element)
                   throws SAXException
        Generates SAX events for the given Element and all its content
        Parameters:
        element - is the Element to parse
        Throws:
        SAXException - if there is a SAX error processing the events
      • writeOpen

        public void writeOpen​(Element element)
                       throws SAXException

        Writes the opening tag of an Element, including its Attributes but without its content.

        Parameters:
        element - Element to output.
        Throws:
        SAXException - DOCUMENT ME!
      • writeClose

        public void writeClose​(Element element)
                        throws SAXException

        Writes the closing tag of an Element

        Parameters:
        element - Element to output.
        Throws:
        SAXException - DOCUMENT ME!
      • write

        public void write​(String text)
                   throws SAXException
        Generates SAX events for the given text
        Parameters:
        text - is the text to send to the SAX ContentHandler
        Throws:
        SAXException - if there is a SAX error processing the events
      • write

        public void write​(CDATASection cdata)
                   throws SAXException
        Generates SAX events for the given CDATA
        Parameters:
        cdata - is the CDATA to parse
        Throws:
        SAXException - if there is a SAX error processing the events
      • write

        public void write​(Comment comment)
                   throws SAXException
        Generates SAX events for the given Comment
        Parameters:
        comment - is the Comment to parse
        Throws:
        SAXException - if there is a SAX error processing the events
      • write

        public void write​(Entity entity)
                   throws SAXException
        Generates SAX events for the given Entity
        Parameters:
        entity - is the Entity to parse
        Throws:
        SAXException - if there is a SAX error processing the events
      • write

        public void write​(ProcessingInstruction pi)
                   throws SAXException
        Generates SAX events for the given ProcessingInstruction
        Parameters:
        pi - is the ProcessingInstruction to parse
        Throws:
        SAXException - if there is a SAX error processing the events
      • isDeclareNamespaceAttributes

        public boolean isDeclareNamespaceAttributes()
        Should namespace declarations be converted to "xmlns" attributes. This property defaults to false as per the SAX specification. This property is set via the SAX feature "http://xml.org/sax/features/namespace-prefixes"
        Returns:
        DOCUMENT ME!
      • setDeclareNamespaceAttributes

        public void setDeclareNamespaceAttributes​(boolean declareNamespaceAttrs)
        Sets whether namespace declarations should be exported as "xmlns" attributes or not. This property is set from the SAX feature "http://xml.org/sax/features/namespace-prefixes"
        Parameters:
        declareNamespaceAttrs - DOCUMENT ME!
      • setContentHandler

        public void setContentHandler​(ContentHandler contentHandler)
        Sets the ContentHandler called when SAX events are raised
        Specified by:
        setContentHandler in interface XMLReader
        Parameters:
        contentHandler - is the ContentHandler called when SAX events are raised
      • setDTDHandler

        public void setDTDHandler​(DTDHandler handler)
        Sets the DTDHandler.
        Specified by:
        setDTDHandler in interface XMLReader
        Parameters:
        handler - DOCUMENT ME!
      • setErrorHandler

        public void setErrorHandler​(ErrorHandler errorHandler)
        Sets the ErrorHandler.
        Specified by:
        setErrorHandler in interface XMLReader
        Parameters:
        errorHandler - DOCUMENT ME!
      • setEntityResolver

        public void setEntityResolver​(EntityResolver entityResolver)
        Sets the EntityResolver.
        Specified by:
        setEntityResolver in interface XMLReader
        Parameters:
        entityResolver - is the EntityResolver
      • getLexicalHandler

        public LexicalHandler getLexicalHandler()
        DOCUMENT ME!
        Returns:
        the LexicalHandler used when a Document contains a DTD
      • setLexicalHandler

        public void setLexicalHandler​(LexicalHandler lexicalHandler)
        Sets the LexicalHandler.
        Parameters:
        lexicalHandler - is the LexicalHandler
      • setXMLReader

        public void setXMLReader​(XMLReader xmlReader)
        Sets the XMLReader used to write SAX events to
        Parameters:
        xmlReader - is the XMLReader
      • setProperty

        public void setProperty​(String name,
                                Object value)
        Sets the given SAX property
        Specified by:
        setProperty in interface XMLReader
        Parameters:
        name - DOCUMENT ME!
        value - DOCUMENT ME!
      • documentLocator

        protected void documentLocator​(Document document)
                                throws SAXException
        The Locatoris only really useful when parsing a textual document as its main purpose is to identify the line and column number. Since we are processing an in memory tree which will probably have its line number information removed, we'll just use -1 for the line and column numbers.
        Parameters:
        document - DOCUMENT ME!
        Throws:
        SAXException - DOCUMENT ME!
      • dtdHandler

        protected void dtdHandler​(Document document)
                           throws SAXException
        We do not yet support DTD or XML Schemas so this method does nothing right now.
        Parameters:
        document - DOCUMENT ME!
        Throws:
        SAXException - DOCUMENT ME!
      • startPrefixMapping

        protected AttributesImpl startPrefixMapping​(Element element,
                                                    Stack<QName> namespaceStack)
                                             throws SAXException
        Fires a SAX startPrefixMapping event for all the namespaceStack which have just come into scope
        Parameters:
        element - DOCUMENT ME!
        namespaceStack - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
        Throws:
        SAXException - DOCUMENT ME!
      • endPrefixMapping

        protected void endPrefixMapping​(Stack<QName> stack,
                                        int stackSize)
                                 throws SAXException
        Fires a SAX endPrefixMapping event for all the namespaceStack which have gone out of scope
        Parameters:
        stack - DOCUMENT ME!
        stackSize - DOCUMENT ME!
        Throws:
        SAXException - DOCUMENT ME!
      • addNamespaceAttribute

        protected AttributesImpl addNamespaceAttribute​(AttributesImpl attrs,
                                                       QName namespace)
        If isDelcareNamespaceAttributes() is enabled then this method will add the given namespace declaration to the supplied attributes object, creating one if it does not exist.
        Parameters:
        attrs - DOCUMENT ME!
        namespace - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • isIgnoreableNamespace

        protected boolean isIgnoreableNamespace​(QName namespace,
                                                Stack<QName> namespaceStack)
        DOCUMENT ME!
        Parameters:
        namespace - DOCUMENT ME!
        namespaceStack - DOCUMENT ME!
        Returns:
        true if the given namespace is an ignorable namespace (such as Namespace.NO_NAMESPACE or Namespace.XML_NAMESPACE) or if the namespace has already been declared in the current scope
      • checkForNullHandlers

        protected void checkForNullHandlers()
        Ensures non-null content handlers?