extract the first child node of an XML tree - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Connectivity : Web Features : XMLTools : XMLTools/FirstChild

XMLTools[FirstChild] - extract the first child node of an XML tree

XMLTools[SecondChild] - extract the second child node of an XML tree

XMLTools[ThirdChild] - extract the third child node of an XML tree

XMLTools[LastChild] - extract the last child node of an XML tree

 Calling Sequence FirstChild(xmlTree) SecondChild(xmlTree) ThirdChild(xmlTree) LastChild(xmlTree)

Parameters

 xmlTree - Maple XML tree; XML element

Description

 • Each of these routines accesses a particular child of the given XML element xmlTree. The returned expression is either of type string (NULL is returned in the case of a plain text child node) or an XML tree data structure (when the child node has a tree structure of its own).
 Each of these procedures is a specialization of the GetChild routine for common special cases. For instance, SecondChild retrieves the second content element of xmlTree if there are at least two such children. Otherwise, NULL is returned.

Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $x:=\mathrm{XMLElement}\left("a",\left["colour"="red"\right],\mathrm{XMLElement}\left("b",\left[\right],"foo"\right),\mathrm{XMLElement}\left("c",\left[\right],"bar"\right),\mathrm{XMLElement}\left("d",\left[\right],"baz"\right)\right):$
 > $\mathrm{Print}\left(x\right)$
   foo   bar   baz
 > $\mathrm{Print}\left(\mathrm{FirstChild}\left(x\right)\right)$
 foo
 > $\mathrm{Print}\left(\mathrm{SecondChild}\left(x\right)\right)$
 bar
 > $\mathrm{Print}\left(\mathrm{ThirdChild}\left(x\right)\right)$
 baz
 > $\mathrm{Print}\left(\mathrm{LastChild}\left(x\right)\right)$
 baz
 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam