MoveXMLNode()

Syntax

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

Parameters

Node The node to move.
ParentNode The node into which to insert the node. To insert the node at the root of the tree, RootXMLNode() can be used here.
PreviousNode (optional) A childnode of 'ParentNode' after which the node should be inserted. If this value is 0 or not specified, the 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

Nonzero if the move was successful or zero if the node could not be moved.

Remarks

The following rules must be followed for a successful move:
- The root node of a tree cannot be moved
- 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)
- Node and PreviousNode cannot be equal
- ParentNode cannot be equal to, or a child of Node (a node cannot be moved into itself)
- 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(), CopyXMLNode()

Supported OS

All

<- MainXMLNode() - XML Index - NextXMLAttribute() ->