Class DOM4JDocumentWrapper

    • Constructor Detail

      • DOM4JDocumentWrapper

        public DOM4JDocumentWrapper​(org.dom4j.Document doc,
                                    java.lang.String baseURI,
                                    Configuration config)
        Create a Saxon wrapper for a dom4j document
        Parameters:
        doc - The dom4j document
        baseURI - The base URI for all the nodes in the document
        config - The Saxon configuration
    • Method Detail

      • deliver

        public void deliver​(Receiver receiver,
                            ParseOptions options)
                     throws XPathException
        Implement ActiveSource by delivering the document to a supplied receiver
        Specified by:
        deliver in interface ActiveSource
        Parameters:
        receiver - the receiver to which events representing the parsed XML document will be sent
        options - options for parsing the source
        Throws:
        XPathException - if things don't work out
      • wrap

        public NodeInfo wrap​(org.dom4j.Node node)
        Wrap a node in the dom4j document.
        Parameters:
        node - The node to be wrapped. This must be a node in the same document (the system does not check for this).
        Returns:
        the wrapping NodeInfo object
      • selectID

        public NodeInfo selectID​(java.lang.String id,
                                 boolean getParent)
        Get the element with a given ID, if any
        Specified by:
        selectID in interface TreeInfo
        Overrides:
        selectID in class GenericTreeInfo
        Parameters:
        id - the required ID value
        getParent - true if the parent of the element having ID type is required
        Returns:
        null: dom4j does not provide any information about attribute types.
      • searchForParent

        public static org.dom4j.Branch searchForParent​(org.dom4j.Branch subtree,
                                                       org.dom4j.Node node)
        DOM4J does not guarantee to provide the parent of a node, but XDM requires this. In extremis, if we need the parent of a node and it is not known, we search the document looking for it. This is (fortunately!) very rarely necessary. One situation where we know it is needed is to find the parent of a processing instruction whose parent is in fact the document node.
        Parameters:
        subtree - the root of a subtree to be searched
        node - a node to be sought within this subtree
        Returns:
        the parent of the sought node if it is found; otherwise null