Provides access to members that control XML attributes.
Product Availability
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Members
Classes that implement IXMLAttributes
Classes |
Description |
XMLAttributes |
A collection of XML element attributes. |
Remarks
In XML (as well as in HTML) attributes provide additional information about elements.
For example,
<software cpu="800 Mhz" min_memory="256 mb" rec_memory="512 mb">ArcInfo</software >Software element has cpu, min_memory, and rec_memory attributes that specify hardware requirements for ArcInfo.
Use the
AddAttribute method to add new attributes to the element, the
DeleteAttribute method to remove any unwanted attributes from the attribute list. The
FindAttribute method searches for the attribute based on its local name (in our case: cpu, min_memory, or rec_memory) and its namespace URI (Unique Resource Identifier), and returns the index at which the searched attribute was found. The
AttributeCount property returns number of attributes in the list. The
LocalName,
NamespaceURI, and
Value properties return local name, URI, and value of the attribute.
Example (VB6):
Dim pXMLAttributes As IXMLAttributes
Set pXMLAttributes = new XMLAttributes
'*** Add a few attributes to the attribute list ***
pXMLAttributes.AddAttribute "first", "", "First name"
pXMLAttributes.AddAttribute "last", "", "Last name"
pXMLAttributes.AddAttribute "middle", "", "Middle name"
'*** Remove the middle name attribute ***
pXMLAttributes.DeleteAttribute "middle", ""
'*** Count the number of attributes in the list ***
Dim count as Long
count = pXMLAttributes.AttributeCount
'*** Get the index of the Last name attribute ***
Dim index as Long
index = pXMLAttributes.FindAttribute "last", ""
'*** Get local name, uri, and value ***
Dim localName as String
Dim uri as String
Dim value as String
localName = pXMLAttributes.LocalName(index)
uri = pXMLAttributes.NamespaceURI(index)
value = pXMLAttributes.Value(index)< /P >< /P >