XMLTools - Maple Programming Help

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

XMLTools

 AttrCont
 split an XML element into its attributes and content

 Calling Sequence AttrCont(xmlTree)

Parameters

 xmlTree - Maple XML tree; XML element

Description

 • The AttrCont(xmlTree) command separates the attributes and content of an XML element and returns them in an expression sequence of two lists. The first list is a list of equations that represent the attributes, each of whose left and right sides are strings. The second list is a list of expressions that represent the content where each of the expressions is of one of the types function or string.
 • Except for efficiency, the call AttrCont(xmlTree) is equivalent to using Attributes(xmlTree), ContentModel(xmlTree). When both the content model and the attributes are required, it is more efficient to call AttrCont than to use Attributes and ContentModel individually.

Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $\mathrm{xmlTree}≔\mathrm{XMLElement}\left("a",\left["colour"="red"\right],\mathrm{XMLElement}\left("b",\left["size"="2"\right],"some text"\right),"more text"\right)$
 ${\mathrm{xmlTree}}{≔}{\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"a"}\right){,}\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"colour"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"red"}\right)\right)\right]{,}\left[{\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"b"}\right){,}\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"size"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"2"}\right)\right)\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"some text"}\right)\right]\right){,}{\mathrm{_XML_Text}}{}\left({"more text"}\right)\right]\right)$ (1)
 > $\mathrm{AttrCont}\left(\mathrm{xmlTree}\right)$
 $\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"colour"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"red"}\right)\right)\right]{,}\left[{\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"b"}\right){,}\left[{\mathrm{_XML_Attribute}}{}\left({\mathrm{_XML_AttrName}}{}\left({"size"}\right){,}{\mathrm{_XML_AttrValue}}{}\left({"2"}\right)\right)\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"some text"}\right)\right]\right){,}{\mathrm{_XML_Text}}{}\left({"more text"}\right)\right]$ (2)