Xml.AppendChild

Overview

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.

Xml myXml.AppendChild(xpath: string)

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.

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

Arguments

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.

Example

Append node

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

Example

Append node with callback

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

Copyright © 2010 - 2023 Emakin. All rights reserved.