IXMLAttributes Interface

Provides access to members that control XML attributes.

Members

Name Description
Method AddAttribute Adds an attribute to the element.
Read-only property AttributeCount Number of attributes.
Method DeleteAttribute Deletes an attribute from the element.
Method FindAttribute Finds an attribute by name and namespace.
Read-only property LocalName Name of the attribute.
Read-only property NamespaceURI Namespace of the attribute.
Read-only property Value Value of the attribute.

IXMLAttributes.AddAttribute Method

Adds an attribute to the element.

Public Sub AddAttribute ( _
    ByVal LocalName As String, _
    ByVal NamespaceURI As String, _
    ByVal Value As String _
)
public void AddAttribute (
    string LocalName,
    string NamespaceURI,
    string Value
);

IXMLAttributes.AttributeCount Property

Number of attributes.

Public ReadOnly Property AttributeCount As Integer
public int AttributeCount {get;}

IXMLAttributes.DeleteAttribute Method

Deletes an attribute from the element.

Public Sub DeleteAttribute ( _
    ByVal LocalName As String, _
    ByVal NamespaceURI As String _
)
public void DeleteAttribute (
    string LocalName,
    string NamespaceURI
);

IXMLAttributes.FindAttribute Method

Finds an attribute by name and namespace.

Public Function FindAttribute ( _
    ByVal LocalName As String, _
    ByVal NamespaceURI As String _
) As Integer
public int FindAttribute (
    string LocalName,
    string NamespaceURI
);

IXMLAttributes.LocalName Property

Name of the attribute.

Public Function get_LocalName ( _
    ByVal Index As Integer _
) As String
public string get_LocalName (
    int Index
);

IXMLAttributes.NamespaceURI Property

Namespace of the attribute.

Public Function get_NamespaceURI ( _
    ByVal Index As Integer _
) As String
public string get_NamespaceURI (
    int Index
);

IXMLAttributes.Value Property

Value of the attribute.

Public Function get_Value ( _
    ByVal Index As Integer _
) As String
public string get_Value (
    int Index
);

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 FindAttributemethod**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 IXMLAttributesSet 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 Longcount = pXMLAttributes.AttributeCount'*** Get the index of the Last name attribute ***Dim index as Longindex = pXMLAttributes.FindAttribute "last", ""'*** Get local name, uri, and value ***Dim localName as StringDim uri as StringDim value as StringlocalName = pXMLAttributes.LocalName(index)uri = pXMLAttributes.NamespaceURI(index)value = pXMLAttributes.Value(index)< /P >< /P >

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.