RemoveChild - Maple Help

XMLTools

 RemoveChild
 remove a child element from an XML element

 Calling Sequence RemoveChild(xmlTree, child)

Parameters

 xmlTree - Maple XML tree; XML element child - XML element or positive integer; child element or position of the child element to remove from the xmlTree

Description

 • The RemoveChild(xmlTree, child) command removes the child node child from the XML element xmlTree. All children equal to the specified child are removed unless the child argument is a positive integer less than or equal to the number of children of the tree. (The positive integer is taken to represent the position of a child and only that child node is removed.)
 Note: The input XML tree is not modified; a copy of the tree is returned with the indicated child removed.

Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $x≔\mathrm{XMLElement}\left("a",\left[\right],\mathrm{XMLElement}\left("b",\left["colour"="red"\right],"foo"\right),\mathrm{XMLElement}\left("c",\left["colour"="blue"\right],"bar"\right),\mathrm{XMLElement}\left("d",\left[\right],"baz"\right)\right):$
 > $\mathrm{Print}\left(x\right)$
   foo   bar   baz
 > $\mathrm{Print}\left(\mathrm{RemoveChild}\left(x,2\right)\right)$
   foo   baz
 > $\mathrm{Print}\left(\mathrm{RemoveChild}\left(x,\mathrm{XMLElement}\left("d",\left[\right],"baz"\right)\right)\right)$
   foo   bar