Skip to content

AppendChild

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.

1
myXml.AppendChild(xpath: string):Xml

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.

1
myXml.AppendChild(xpath: string, callback: (node: Xml) => any):Xml

Parameters

string xpath
    XPath of node to be append

(node: Xml) => any 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 Xml.Bind or Xml.Live.
Function returns created node after node is appended on DOM tree.
Callback function is called before adding the document.

Append node

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

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 Xml.Bind or Xml.Live.
Function returns created node after node is appended on DOM tree.
Callback function is called before adding the document.

Append node with callback

1
2
3
$Xml.AppendChild('Customers/Customer', function(newNode) \{
  newNode.SetValue('Id','1');
\});

See Also