com.esri.arcgis.system
Interface IXMLAttributes

All Superinterfaces:
Serializable
All Known Implementing Classes:
XMLAttributes

public interface IXMLAttributes
extends Serializable

Provides access to members that control XML 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 >

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux


Method Summary
 void addAttribute(String localName, String namespaceURI, String value)
          Adds an attribute to the element.
 void deleteAttribute(String localName, String namespaceURI)
          Deletes an attribute from the element.
 int findAttribute(String localName, String namespaceURI)
          Finds an attribute by name and namespace.
 int getAttributeCount()
          Number of attributes.
 String getLocalName(int index)
          Name of the attribute.
 String getNamespaceURI(int index)
          Namespace of the attribute.
 String getValue(int index)
          Value of the attribute.
 

Method Detail

addAttribute

void addAttribute(String localName,
                  String namespaceURI,
                  String value)
                  throws IOException,
                         AutomationException
Adds an attribute to the element.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
localName - The localName (in)
namespaceURI - The namespaceURI (in)
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deleteAttribute

void deleteAttribute(String localName,
                     String namespaceURI)
                     throws IOException,
                            AutomationException
Deletes an attribute from the element.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
localName - The localName (in)
namespaceURI - The namespaceURI (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

findAttribute

int findAttribute(String localName,
                  String namespaceURI)
                  throws IOException,
                         AutomationException
Finds an attribute by name and namespace.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
localName - The localName (in)
namespaceURI - The namespaceURI (in)
Returns:
The index
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getAttributeCount

int getAttributeCount()
                      throws IOException,
                             AutomationException
Number of attributes.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLocalName

String getLocalName(int index)
                    throws IOException,
                           AutomationException
Name of the attribute.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
index - The index (in)
Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getNamespaceURI

String getNamespaceURI(int index)
                       throws IOException,
                              AutomationException
Namespace of the attribute.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
index - The index (in)
Returns:
The uri
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getValue

String getValue(int index)
                throws IOException,
                       AutomationException
Value of the attribute.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
index - The index (in)
Returns:
The value
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.