com.esri.arcgis.system
Interface IXMLReader

All Superinterfaces:
Serializable
All Known Implementing Classes:
XMLReader

public interface IXMLReader
extends Serializable

Provides access to members that control the sequential reading of XML.

Remarks

The IXMLReader interface provides twenty two methods to use for reading specific data elements.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux


Method Summary
 void closeElement()
          Moves position to parent element.
 IXMLAttributes getAttributes()
          Attributes of current element.
 String getLocalName()
          Local name of current element.
 IXMLNamespaces getNamespaceDeclarations()
          Namespace declarations of current element.
 String getNamespacePrefix()
          Namespace prefix of current element.
 String getNamespaceURI()
          Namespace URI of current element.
 String getText()
          Text value of current element.
 boolean isHasElementChildren()
          Indicates whether the current element has child elements.
 boolean isLastChild()
          Indicates whether the current element is the last child element of its parent.
 String lookupPrefix(String prefix)
          Returns the prefix for a declared URI.
 void nextElement()
          Moves position to next element.
 void openElement()
          Moves position to first child element.
 byte[] readBinary()
          Reads the current element value as a binary array.
 boolean readBoolean()
          Reads the current element value as a boolean.
 byte readByte()
          Reads the current element value as a byte.
 Date readDate()
          Reads the current element value as a date.
 double readDouble()
          Reads the current element value as a double.
 float readFloat()
          Reads the current element value as a float.
 void readFrom(IStream inputStream)
          Specifies the input XML stream.
 int readInteger()
          Reads the current element value as a long.
 short readShort()
          Reads the current element value as a short.
 Object readVariant()
          Reads the current element value as a variant.
 

Method Detail

readFrom

void readFrom(IStream inputStream)
              throws IOException,
                     AutomationException
Specifies the input XML stream.

Remarks

The ReadFrom method specifies the input XML stream.

For example:

Dim pXmlReader As IXMLReader
Set pXmlReader = New XMLReader


Dim pXmlStream as IXMLStream
Set pXmlStream = new XMLStream


pXmlStream.OpenFromFile App.Path & "\file.xml"
pXmlReader.ReadFrom pXmlStream


If xml file is empty the XMLStream will evoke Automation error. Xml file needs to be of a proper structure.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
inputStream - A reference to a com.esri.arcgis.system.IStream (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLocalName

String getLocalName()
                    throws IOException,
                           AutomationException
Local name of current element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getNamespaceURI

String getNamespaceURI()
                       throws IOException,
                              AutomationException
Namespace URI of current element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getNamespacePrefix

String getNamespacePrefix()
                          throws IOException,
                                 AutomationException
Namespace prefix of current element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getNamespaceDeclarations

IXMLNamespaces getNamespaceDeclarations()
                                        throws IOException,
                                               AutomationException
Namespace declarations of current element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.system.IXMLNamespaces
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getAttributes

IXMLAttributes getAttributes()
                             throws IOException,
                                    AutomationException
Attributes of current element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.system.IXMLAttributes
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getText

String getText()
               throws IOException,
                      AutomationException
Text value of current element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

isHasElementChildren

boolean isHasElementChildren()
                             throws IOException,
                                    AutomationException
Indicates whether the current element has child elements.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

isLastChild

boolean isLastChild()
                    throws IOException,
                           AutomationException
Indicates whether the current element is the last child element of its parent.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

nextElement

void nextElement()
                 throws IOException,
                        AutomationException
Moves position to next element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

openElement

void openElement()
                 throws IOException,
                        AutomationException
Moves position to first child element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

closeElement

void closeElement()
                  throws IOException,
                         AutomationException
Moves position to parent element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

lookupPrefix

String lookupPrefix(String prefix)
                    throws IOException,
                           AutomationException
Returns the prefix for a declared URI.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readBoolean

boolean readBoolean()
                    throws IOException,
                           AutomationException
Reads the current element value as a boolean.

Remarks

The ReadBoolean method specifies the current element value as a boolean.

Element value 1 or true will return boolean value of true, anything else will return false.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readByte

byte readByte()
              throws IOException,
                     AutomationException
Reads the current element value as a byte.

Description

Remarks

The ReadByte method specifies the current element value as a byte.

Byte variables are stored as single, unsigned 8 bit numbers (1 byte), its range is from 0 to 255. Anything below and above these numbers will cause the Invalid Procedure Call Error.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Returns:
An unsigned byte
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readShort

short readShort()
                throws IOException,
                       AutomationException
Reads the current element value as a short.

Remarks

The ReadShort method specifies the current element value as a short.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readInteger

int readInteger()
                throws IOException,
                       AutomationException
Reads the current element value as a long.

Remarks

The ReadInteger method specifies the current element value as a Integer.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readFloat

float readFloat()
                throws IOException,
                       AutomationException
Reads the current element value as a float.

Remarks

The ReadFloat method specifies the current element value as a float.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readDouble

double readDouble()
                  throws IOException,
                         AutomationException
Reads the current element value as a double.

Remarks

The ReadDouble method specifies the current element value as a double.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readDate

Date readDate()
              throws IOException,
                     AutomationException
Reads the current element value as a date.

Remarks

The ReadDate method specifies the current element value as a date.
Date value in xml file should be only of this format:
2005-01-28T12:17:58
otherwise the ReadDate will invoke Invalid Procedure Call Error.

Example of "data.xml" file:

<?xml version="1.0"?>
<Data description="example of ReadDate">
<type>
<date>2005-01-28T12:23:34</date>

</type>

</Data>

VB6 code to get date value:

Dim pXMLStream As IXMLStream
Set pXMLStream = New XMLStream

pXMLStream.LoadFromFile App.Path + "\data.xml"

pXMLReader.OpenElement
pXMLReader.OpenElement

Dim dateValue As Date
dateValue = pXMLReader.ReadDate

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

readBinary

byte[] readBinary()
                  throws IOException,
                         AutomationException
Reads the current element value as a binary array.

Remarks

The ReadBinary method specifies the current element value as a binary array.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Returns:
An unsigned byte
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readVariant

Object readVariant()
                   throws IOException,
                          AutomationException
Reads the current element value as a variant.

Remarks

The ReadVariant method specifies the current element value as a variant.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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