Import a node from another file into this file. The returned node does not have a parent; (parentNode is null). The origin node is not altered or deleted from the origin file; this method creates a new copy from the origin node.

For all the nodes, import a node creates a node object. It belong to the imported file, with values of nodeName and nodeType attribute identical to the origin node, in addition to the attributes related with namespaces (prefix, localName and namespaceURI).

While the cloneNode operates in a node, the origin is not altered. The additional information is properly copied to the nodeType, trying to imitate the expected behavior if a origin XML or HTML fragment was copied from one document to another. In the XML case the funtion will recognize which both files can have differents DTDs. The following list describes the specifications of each type of node.

1 dom.document.importNode

<dom.document.importNode deep='deep'>
    <node_orig /> !
    <node_import /> !
</dom.document.importNode>

Exceptions

DOMException

Appears when the type of imported node is not supported.

Example

Import a XML node to a XML file.

Copy
<xsql-script name='dom_importNode'>

    <body>

        <set name='node_orig'>
            <dom.parse><file name='data1.xml' type='absolute' /></dom.parse>
        </set>
        <set name='node_import'>
            <dom.parse><file name='data2.xml' type='absolute' /></dom.parse>
        </set>

        <set name='resul'>
            <dom.document.importNode>
                <node_orig />
                <node_import />
            </dom.document.importNode>
        </set>

        <println>
            <resul/>
        </println>

    </body>
</xsql-script>