RemoveAttributes - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

XMLTools

 SelectAttributes
 select attributes of an XML element
 RemoveAttributes
 remove attributes of an XML element
 SelectRemoveAttributes
 select and remove attributes of an XML element

 Calling Sequence SelectAttributes(p, xmlTree) RemoveAttributes(p, xmlTree) SelectRemoveAttributes(p, xmlTree)

Parameters

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

Description

 • The SelectAttributes(p, xmlTree) command returns the list of ordered attributes of the XML element xmlTree that satisfy the specified predicate p. The list that is returned is a (possibly empty) list of attribute data structures.
 If no attribute of the input tree satisfies the given predicate, then an empty list is returned.
 • The RemoveAttributes(p, xmlTree) command returns the list of ordered attributes of the XML element xmlTree that do not satisfy the specified predicate p. The list that is returned is a (possible empty) list of attribute data structures.
 • The SelectRemoveAttributes(p, xmlTree) command is equivalent to the procedure (SelectAttributes, RemoveAttributes). That is,
 • SelectRemoveAttributes( p, x ) = ( SelectAttributes( p, x ), RemoveAttributes( 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. Attributes data structures are passed to the predicate.
 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["width"="2","height"="6","bgcolour"="blue","fgcolour"="green"\right],"foo",\mathrm{XMLElement}\left("b",\left[\right],"bar"\right)\right):$
 > $\mathrm{Print}\left(x\right)$
   foo   bar
 > $\mathrm{map}\left(\mathrm{Print},\mathrm{SelectAttributes}\left(\mathrm{attr}→\mathrm{type}\left(\mathrm{eval}\left(\mathrm{parse}\left(\mathrm{op}\left(\left[2,1\right],\mathrm{attr}\right)\right)\right),'\mathrm{integer}'\right),x\right)\right)$
 width = '2' height = '6'
 $\left[\right]$ (1)
 > $\mathrm{map}\left(\mathrm{Print},\mathrm{RemoveAttributes}\left(\mathrm{attr}→\mathrm{type}\left(\mathrm{eval}\left(\mathrm{parse}\left(\mathrm{op}\left(\left[2,1\right],\mathrm{attr}\right)\right)\right),'\mathrm{integer}'\right),x\right)\right)$
 bgcolour = 'blue' fgcolour = 'green'
 $\left[\right]$ (2)
 > $s≔\mathrm{SelectRemoveAttributes}\left(\mathrm{attr}→\mathrm{type}\left(\mathrm{eval}\left(\mathrm{parse}\left(\mathrm{op}\left(\left[2,1\right],\mathrm{attr}\right)\right)\right),'\mathrm{integer}'\right),x\right):$
 > $\mathrm{map}\left(\mathrm{Print},{s}_{1}\right)$
 width = '2' height = '6'
 $\left[\right]$ (3)
 > $\mathrm{map}\left(\mathrm{Print},{s}_{2}\right)$
 bgcolour = 'blue' fgcolour = 'green'
 $\left[\right]$ (4)