Methods used for manipulating XMLDOCUMENT variables

These methods are used to modify the content of the XMLDOCUMENT variable directly by adding or removing nodes.

clone()

This method returns a value of the XMLNODE data type which will contain the exact copy of the root node of the document, referenced by the variable. It accepts no parameters. E.g.:

CALL xmldocument_var.Clone()

importNode()

This method creates a new node under the ownership of the document as a copy of the node passed as the parameter.

 

It accepts two parameters: the first parameter of the XMLNODE data type should contain the node to be copied and the "recursive" parameter of the BOOLEAN data type which is optional. The recursive parameter specifies whether only the root node will be imported or the child nodes also. If it parameter is set to TRUE, the child nodes are also imported. The default value of this parameter is TRUE, so if it is omitted, the children are copied together with the parent node:

LET xmlnode_var = xmldocument_var.ImportNode(new_node_var,0)

This method returns a value of the XMLNODE data type which represents the imported node. It does not specify where within the document the copy of the node should exist, so to actually add the imported node to the document you need to use other methods. For example you can append the copied node to an existing node within the document:

LET n = d.importNode(somenode)  -- creates a copy of "somenode"

LET de = d.GetDocumentElement() -- retrieves an existing node

CALL de.AppendChild(n)          -- adds the copy inside the existing node as its last child

prependDocumentNode()

This method adds the node passed to it as a parameter to the beginning of the XML document referenced by the variable. It accepts a single parameter of the XMLNODE data type. E.g.:

CALL xmldocument_var.PrependDocumentNode(xmlnode_var)

insertBeforeDocumentNode()

This method inserts the new node into the document referenced by the variable immediately before the node specified as a parameter. It accepts two parameters, both of which are of the XMLNODE data type. The first parameter is the XMLNODE variable containing the new node to be inserted. The second parameter is the XMLNODE variable containing a node which already exists within the document. The new node is added before the existing one. Here is the syntax:

xmldocument_var.InsertBeforeDocumentNode(new_node, existing_node)

removeDocumentNode()

This method removes the specified node from the referenced document. It accepts a single parameter of the XMLNODE data type which indicates the node to be deleted. E.g.:

CALL xmldocument_var.RemoveDocumentNode(existing_node)

 

Contact Us

Privacy Policy

Copyright © 2026 Querix, (UK) Ltd.