Skip to content

Remove

Removes the current node and returns it in an array.

1
myXml.Remove():Array<Xml>

Removes all nodes at the specified XPath and returns the removed nodes in an array.

1
myXml.Remove(xpath: string):Array<Xml>

Parameters

string xpath
    The XPath of the nodes to remove. If not specified, the current node is used.

Returns

The removed nodes.

Remarks

The nodes are removed from the document immediately. To mark rows as deleted the way container form controls do, set their State attribute instead and remove them later with Xml.CommitDeletes.

Examples

Remove a selected node

1
2
3
4
5
var line = $Xml.SelectSingle("Lines/Line[Product = 'Pen']");

if (line) {
    line.Remove();
}

Remove nodes that match a condition

1
2
var removed = $Xml.Remove('Lines/Line[Quantity = 0]');
console.log(removed.length + ' empty lines removed.');

See Also