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>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Adeep | Boolean | false |
If it is true, recursively imports the subtree under the specified node. If it is false, only imports the node itself. It has no effect in Attr, EntityReference and Notation nodes. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Enode_orig | Node | The origin file. | |||
Enode_import | Node | The node to import. |
Returns | |
---|---|
Type | Description |
Node | The imported node which belong to this file. |
Exceptions
DOMException
Appears when the type of imported node is not supported.
Import a XML node to a XML file.
<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>