Adds a node at the end of the list of childs of the indicated node. If the node to add already exist in the tree, it will be deleted.

1 dom.appendChild

<dom.appendChild type='node|text|cdata|comment|element'>
    <node /> !
    <newChild /> !



It appears if this node is of a type which does not allow childs of the typeof of the node newChild, or if the node to be added is one of the ancestors of this node.


It appears if newChild has been created from a different file than the one that created this node.


It appears if this node is readonly or if the previous parent of the node being inserted is readonly.


If the node to be added does not belong to the document to which the node in which it is to be added belongs, it is necessary to first make an import of the node to be added, in order to decontextualize it. This means, unlink it from its owner document and from this way to use it in a different document. This operation should be performed when it is added ( dom.node.insertBefore), is replaced ( dom.node.replaceChild) or is inserted ( dom.node.insertBefore).


Add a node of a file to a different file.

<xsql-script name='dom_node_appendChild'>

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

        <!-- The node should be imported first, to unlink it from its                      -->
        <!-- own file and be able to use it in a new document.                             -->
        <!-- nodo node_add does not have own document and point to a node of the root_add. -->
        <set name='node_add'>

Return the added element:

    <elem>text of node to import</elem>

        <println>Added Node:</println>

Returns the original file with the added node:

    <elem>text of node to import</elem>

        <println>Original file with the new added node:</println>