Skip to content

XmlNode.AppendChild

Overview

XmlNode XmlNode.AppendChild ( xpath, [ callback ] )
Appends a new child in the specified xpath and executes the specified callback on created new node before inserting to DOM and returns the appended new node.

Arguments

String xpath

XPath of node to be append

Function callback

Callback function to be execute.

Remarks

This method creates node and childs nodes according to the xml schema definition. If xml schema definition is not found in xml schema error is thrown.

Qualified node path can be specified in xpath argument when it is required. Example; Customer/Orders/Order

Callback function is executed before node is appended on DOM tree and in callback function, it does not trigger the monitoring events like XmlNode.Bind or XmlNode.Live.

Function returns created node after node is appended on DOM tree.

Callback function is called before adding the document.

Examples

Append node

var customer = $Xml.AppendChild('Customers/Customer');
customer.SetValue('Id','1');

Append node with callback

$Xml.AppendChild('Customers/Customer', function() {
  this.SetValue('Id','1');
});

See Also