RemoveContent - Maple Help

XMLTools

 SelectContent
 select subelements of an XML element
 RemoveContent
 remove subelements of an XML element
 SelectRemoveContent
 select and remove subelements of an XML element

 Calling Sequence SelectContent(p, xmlTree) RemoveContent(p, xmlTree) SelectRemoveContent(p, xmlTree)

Parameters

 p - Maple procedure (or other callable expression) that evaluates to either true or false; predicate for subelements to satisfy xmlTree - Maple XML tree; XML element

Description

 • The SelectContent(p, xmlTree) command returns the list of ordered subelements of the XML element xmlTree that satisfy the specified predicate p.
 If no child node of the input tree satisfies the given predicate, then an empty list is returned.
 • The RemoveContent(p, xmlTree) command returns the list of ordered subelements of the XML element xmlTree that do not satisfy the specified predicate p.
 If every child node of the input tree satisfies the given predicate, then an empty list is returned.
 • The SelectRemoveContent(p, xmlTree) command is equivalent to the procedure (SelectContent, RemoveContent). That is,
 • SelectRemoveContent( p, x ) = ( SelectContent( p, x ), RemoveContent( p, x ) )
 An expression sequence of two lists is returned. Either or both lists may be empty.
 • For all of these functions, any arguments passed after the first two are passed to the call of the predicate without further processing.
 • Note: These functions are analogous to the select, remove, and selectremove functions.

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{map}\left(\mathrm{Print},\mathrm{SelectContent}\left(\mathrm{rcurry}\left(\mathrm{HasAttribute},"colour"\right),x\right)\right):$
 foo bar
 > $\mathrm{map}\left(\mathrm{Print},\mathrm{RemoveContent}\left(\mathrm{rcurry}\left(\mathrm{HasAttribute},"colour"\right),x\right)\right):$
 baz
 > $s≔\mathrm{SelectRemoveContent}\left(\mathrm{rcurry}\left(\mathrm{HasAttribute},"colour"\right),x\right):$
 > $\mathrm{map}\left(\mathrm{Print},s\left[1\right]\right):$
 foo bar
 > $\mathrm{map}\left(\mathrm{Print},s\left[2\right]\right):$
 baz