It seems to be another solution to my problem:

DOM_Document::importNode() and DOM_Node::replaceChild:

Hie's the code, that does it:

DOM_Document src_doc;
DOM_Document trg_doc;

DOM_Node src_node = find_src_node(src_doc);
DOM_Node trg_node = find_trg_node(trg_node);

DOM_Node imported_node = trg_doc.importNode(src_node, true/*deep*/);

DOM_Node parent = trg_node.getParentNode();

parent.replaceChild(imported_node, trg_node);


The only problem i have is the comment of the

DOM_Document::importNode() function:

    /**
     * Imports a node from another document to this document.
     * The returned node has no parent (<CODE>parentNode</CODE> is
     * <CODE>null</CODE>). The source node is not altered or removed from
the
     * original document; this method creates a new copy of the source
     * node.<BR>For all nodes, importing a node creates a node object owned
by
     * the importing document, with attribute values identical to the
source
     * node's <CODE>nodeName</CODE> and <CODE>nodeType</CODE>, plus the
     * attributes related to namespaces (prefix and namespaces URI).
     *
     * <p><b>"Experimental - subject to change"</b></p>
     *
     * @param importedNode The node to import.
     * @param deep If <CODE>true</CODE>, recursively import the subtree
under the
     *      specified node; if <CODE>false</CODE>, import only the node
itself,
     *      as explained above. This does not apply to
<CODE>DOM_Attr</CODE>,
     *      <CODE>DOM_EntityReference</CODE>, and <CODE>DOM_Notation</CODE>
nodes.
     * @return The imported node that belongs to this
<CODE>DOM_Document</CODE>.
     * @exception DOMException
     *   NOT_SUPPORTED_ERR: Raised if the type of node being imported is
     *                      not supported.
     */


???

     * <p><b>"Experimental - subject to change"</b></p>

What does it mean? Can I use this function in a productiv environment?
(Inclusiv future update, of course).

Thank in advance
David Ostrovsky

Reply via email to