 XMLElement - Maple Help

# Online Help

###### All Products    Maple    MapleSim

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

XMLTools

 XMLElement
 general XML element constructor Calling Sequence XMLElement(s, attrList, children) Parameters

 s - string; name of the XML element to create attrList - (optional) list of equations whose left and right sides are strings; attribute equations in the form $\mathrm{attrName}=\mathrm{attrValue}$, where $\mathrm{attrName}$ is the attribute name and $\mathrm{attrValue}$ is the attribute value children - (optional) sequence or list of XML tree data structures returned by previous calls to the constructor, or other routines that produce XML trees; children of the XML tree Description

 • The XMLElement(s, attrList, children) command is the primary constructor used to create XML elements in Maple.
 • The first argument s is always the name of the element that is created. If no further arguments are included in the calling sequence, then an empty XML element is constructed and returned.
 • The attrList parameter represents the attributes of the newly constructed element.
 • If the third argument children is also a list, then it is taken to be a list of all the child elements to place inside the newly formed element returned by the XMLElement constructor.
 If the arguments after the second argument are not of type list, they are interpreted as being child elements of the tree node.
 If the second argument is not of type list, then all arguments after the first argument are taken to be children of the tree node that is constructed. Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a"\right)\right)$

 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a",\left["colour"="red"\right]\right)\right)$

 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a",\left[\right],"some content"\right)\right)$
 some content
 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a",\left[\right],\mathrm{XMLElement}\left("b",\left["colour"="blue"\right]\right)\right)\right)$

 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a",\left[\right],\left["some content",\mathrm{XMLElement}\left("b",\left["colour"="blue"\right]\right)\right]\right)\right)$
   some content
 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a",\left["colour"="red"\right],\left["some content",\mathrm{XMLElement}\left("b",\left["colour"="blue"\right]\right)\right]\right)\right)$
   some content
 > $\mathrm{Print}\left(\mathrm{XMLElement}\left("a",\left["colour"="red","style"="italic"\right],\left["some content",\mathrm{XMLElement}\left("b",\left["colour"="blue"\right],"more text"\right),"still more text"\right]\right)\right)$
   some content   more text   still more text

 See Also