XMLTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

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

XMLTools

 HasAttribute
 test whether an XML element has a specified attribute

 Calling Sequence HasAttribute(xmlTree, attrName)

Parameters

 xmlTree - Maple XML tree; XML element attrName - string; attribute name

Description

 • The HasAttribute(xmlTree, attrName) command tests whether an attribute with the name attrName is present in the XML element xmlTree. The value true is returned if the attribute is present in xmlTree. Otherwise, false is returned.

Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $x≔\mathrm{XMLElement}\left("a",\left["b"="c"\right],"some text"\right):$
 > $\mathrm{Print}\left(x\right)$
 some text
 > $\mathrm{HasAttribute}\left(x,"b"\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{HasAttribute}\left(x,"c"\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{HasAttribute}\left(x,"a"\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{HasAttribute}\left(x,"d"\right)$
 ${\mathrm{false}}$ (4)

 See Also

## Was this information helpful?

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