XMLTools - Maple Help

Online Help

All Products    Maple    MapleSim


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

XMLTools

  

Attributes

  

return a list of the attributes of an XML element

  

AttributeCount

  

count the number of attributes in an XML element

  

AttributeNames

  

retrieve the names of all attributes present in an XML element

  

AttributeTable

  

construct a table of all attributes present in an XML element

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Attributes(xmlTree)

AttributeCount(xmlTree)

AttributeNames(xmlTree)

AttributeTable(xmlTree)

Parameters

xmlTree

-

Maple XML tree; XML element

Description

• 

The Attributes(xmlTree) command returns the attributes of the XML element, xmlTree, as a list of inert functions of _XML_Attribute. The left side of each equation represents the name of the attribute, and the right side represents the attribute's value. The attribute equations in the list appear in the same order that they appear in in the XML element.

  

If no attributes are found, an empty list is returned.

• 

The AttributeCount(xmlTree) command returns the number of attributes in the XML element xmlTree. This number is always a non-negative integer.

  

Attributes of subelements are not included in the count that is returned.

• 

The AttributeNames(xmlTree) command returns a list of the names of the attributes present in the XML element xmlTree.

  

If no attributes are found, an empty list is returned.

• 

The AttributesTable(xmlTree) command takes an XML element tree structure as input and returns a table containing the attributes in the element. The attributes found in an element can be stored in a table and indexed by the attribute name by using this command.

Examples

withXMLTools:

xmlTreeXMLElementa,colour=red,size=10,XMLElementb,colour=blue,text:

PrintxmlTree

<a colour = 'red' size = '10'>
  <b colour = 'blue'>text</b>
</a>

mapPrint&comma;AttributesxmlTree&colon;

colour = 'red'
size = '10'

AttributeCountxmlTree

2

(1)

AttributeNamesxmlTree

colour&comma;size

(2)

AttributeTablexmlTree

tablesize&equals;10&comma;colour&equals;red

(3)

AttributeCountXMLElementa

0

(4)

AttributeCountXMLElementa&comma;b&equals;c

1

(5)

AttributeCountXMLElementa&comma;b&equals;c&comma;text

1

(6)

AttributeCountXMLElementa&comma;b&equals;c&comma;d&equals;e&comma;text

2

(7)

AttributeNamesXMLElementa

(8)

AttributeNamesXMLElementa&comma;b&equals;c&comma;d&equals;e

b&comma;d

(9)

AttributeNamesXMLElementa&comma;b&equals;c&comma;d&equals;e&comma;XMLTexttext

b&comma;d

(10)

See Also

XMLTools

XMLTools[AttrCont]

XMLTools[HasAttribute]

XMLTools[XMLElement]

 


Download Help Document

Was this information helpful?



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