Interface IXMLAttributes
- Namespace
- ESRI.ArcGIS.esriSystem
- Assembly
- ESRI.Server.System.dll
Provides access to members that control XML attributes.
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("3E23A49E-9F66-42D5-9982-5E3E5C0821E0")]
public interface IXMLAttributes
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 >
Properties
AttributeCount
Number of attributes.
int AttributeCount { get; }
Property Value
LocalName[int]
Name of the attribute.
string LocalName[int Index] { get; }
Parameters
Indexint
Property Value
NamespaceURI[int]
Namespace of the attribute.
string NamespaceURI[int Index] { get; }
Parameters
Indexint
Property Value
Value[int]
Value of the attribute.
string Value[int Index] { get; }
Parameters
Indexint
Property Value
Methods
AddAttribute(string, string, string)
Adds an attribute to the element.
void AddAttribute(string LocalName, string NamespaceURI, string Value)
Parameters
DeleteAttribute(string, string)
Deletes an attribute from the element.
void DeleteAttribute(string LocalName, string NamespaceURI)
Parameters
FindAttribute(string, string)
Finds an attribute by name and namespace.
int FindAttribute(string LocalName, string NamespaceURI)