Class DOMReader

  • All Implemented Interfaces:
    org.xml.sax.XMLReader
    Direct Known Subclasses:
    XMLFragmentReader

    public class DOMReader
    extends XMLReaderAdapter
    INTERNAL:

    Purpose: An implementation of XMLReader for parsing DOM Nodes into SAX events.

    Responsibilities:

    • Walk the DOM tree and report sax events to the provided content handler
    • Report lexical events to the lexical handler if it's provided
    • Listen for callbacks from the Mapping-Level framework to handle caching nodes for document preservation
    • Constructor Detail

      • DOMReader

        public DOMReader()
      • DOMReader

        public DOMReader​(Unmarshaller xmlUnmarshaller)
    • Method Detail

      • parse

        public void parse​(org.xml.sax.InputSource input)
                   throws org.xml.sax.SAXException
        Specified by:
        parse in interface org.xml.sax.XMLReader
        Overrides:
        parse in class XMLReader
        Throws:
        org.xml.sax.SAXException
      • parse

        public void parse​(org.w3c.dom.Node node,
                          java.lang.String newURI,
                          java.lang.String newName)
                   throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • parse

        public void parse​(org.w3c.dom.Node node)
                   throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • processParentNamespaces

        protected void processParentNamespaces​(org.w3c.dom.Element element)
                                        throws org.xml.sax.SAXException
        Process namespace declarations on parent elements if not the root. For each parent node from current to root push each onto a stack, then pop each off, calling startPrefixMapping for each XMLNS attribute. Using a stack ensures that the parent nodes are processed top down.
        Parameters:
        element -
        Throws:
        org.xml.sax.SAXException
      • reportElementEvents

        protected void reportElementEvents​(org.w3c.dom.Element elem)
                                    throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • reportElementEvents

        protected void reportElementEvents​(org.w3c.dom.Element elem,
                                           java.lang.String newUri,
                                           java.lang.String newName)
                                    throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • buildAttributeList

        protected DOMReader.IndexedAttributeList buildAttributeList​(org.w3c.dom.Element elem)
                                                             throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • endPrefixMappings

        protected void endPrefixMappings​(org.w3c.dom.Element elem)
                                  throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • getQName

        protected java.lang.String getQName​(org.w3c.dom.Element elem)
                                     throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • handleNewNamespaceDeclaration

        protected void handleNewNamespaceDeclaration​(org.w3c.dom.Element elem,
                                                     java.lang.String emptyString,
                                                     java.lang.String value)
      • handleXsiTypeAttribute

        protected void handleXsiTypeAttribute​(org.w3c.dom.Attr attr)
                                       throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • handlePrefixedAttribute

        protected void handlePrefixedAttribute​(org.w3c.dom.Element elem)
                                        throws org.xml.sax.SAXException
        Handle prefixed attribute - may need to declare the namespace URI locally.
        Throws:
        org.xml.sax.SAXException
      • handleChildNodes

        protected void handleChildNodes​(org.w3c.dom.NodeList children)
                                 throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • endDocument

        protected void endDocument()
                            throws org.xml.sax.SAXException
        Trigger an endDocument event on the contenthandler.
        Throws:
        org.xml.sax.SAXException
      • startDocument

        protected void startDocument()
                              throws org.xml.sax.SAXException
        Trigger a startDocument event on the contenthandler.
        Throws:
        org.xml.sax.SAXException
      • newObjectEvent

        public void newObjectEvent​(java.lang.Object object,
                                   java.lang.Object parent,
                                   Mapping selfRecordMapping)
        An EclipseLink specific callback into the Reader. This allows Objects to be associated with the XML Nodes they came from.
        Overrides:
        newObjectEvent in class XMLReader
      • setupLocator

        protected void setupLocator​(org.w3c.dom.Document doc)