CopyXMLNode()

Syntax

Result = CopyXMLNode(Node, ParentNode [, PreviousNode])
Description
Copies the given XML node and all its contained text and children to a new location. This function can even be used to copy nodes into a different XML tree. For moving a complete node to a new location MoveXMLNode() can be used.

Parameters

Node The node to copy.
ParentNode The node into which to insert the new node. To insert the new node at the root of the tree, RootXMLNode() can be used here.
PreviousNode (optional) A childnode of 'ParentNode' after which the new node should be inserted. If this value is 0 or not specified, the new node is inserted as the first child of its parent. If this value is -1, the node is inserted as the last child of its parent.

Return value

The new XML node if it was copied successfully or zero if copying was not possible.

Remarks

The following rules must be followed for a successful copying:
- The root node of a tree cannot be copied
- ParentNode may not be of type #PB_XML_Comment or #PB_XML_CData
- PreviousNode must be a direct child of ParentNode (if it is specified)
- If the XML tree already has a main node, only nodes other than #PB_XML_Normal and #PB_XML_CData can be inserted at the root level

See Also

DeleteXMLNode(), MoveXMLNode()

Supported OS

All

<- ComposeXML() - XML Index - CreateXML() ->