Interface IXMLReader

Namespace
ESRI.ArcGIS.esriSystem
Assembly
ESRI.Server.System.dll

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

[Guid("D405F844-8057-4DF4-B2DA-DF25DEDEBF4C")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IXMLReader

Remarks

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

Properties

Attributes

Attributes of current element.

IXMLAttributes Attributes { get; }

Property Value

IXMLAttributes

HasElementChildren

Indicates whether the current element has child elements.

bool HasElementChildren { get; }

Property Value

bool

IsLastChild

Indicates whether the current element is the last child element of its parent.

bool IsLastChild { get; }

Property Value

bool

LocalName

Local name of current element.

string LocalName { get; }

Property Value

string

NamespaceDeclarations

Namespace declarations of current element.

IXMLNamespaces NamespaceDeclarations { get; }

Property Value

IXMLNamespaces

NamespacePrefix

Namespace prefix of current element.

string NamespacePrefix { get; }

Property Value

string

NamespaceURI

Namespace URI of current element.

string NamespaceURI { get; }

Property Value

string

Text

Text value of current element.

string Text { get; }

Property Value

string

Methods

CloseElement()

Moves position to parent element.

void CloseElement()

LookupPrefix(string)

Obtains the prefix for a declared URI.

string LookupPrefix(string Prefix)

Parameters

Prefix string

Returns

string

NextElement()

Moves position to next element.

void NextElement()

OpenElement()

Moves position to first child element.

void OpenElement()

ReadBinary()

Reads the current element value as a binary array.

byte[] ReadBinary()

Returns

byte[]

Remarks

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

ReadBoolean()

Reads the current element value as a boolean.

bool ReadBoolean()

Returns

bool

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.

ReadByte()

Reads the current element value as a byte.

byte ReadByte()

Returns

byte

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.

ReadDate()

Reads the current element value as a date.

DateTime ReadDate()

Returns

DateTime

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

















ReadDouble()

Reads the current element value as a double.

double ReadDouble()

Returns

double

Remarks

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

ReadFloat()

Reads the current element value as a float.

float ReadFloat()

Returns

float

Remarks

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

ReadFrom(IStream)

Specifies the input XML stream.

void ReadFrom(IStream inputStream)

Parameters

inputStream IStream

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.

ReadInteger()

Reads the current element value as a long.

int ReadInteger()

Returns

int

Remarks

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

ReadShort()

Reads the current element value as a short.

short ReadShort()

Returns

short

Remarks

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

ReadVariant()

Reads the current element value as a variant.

object ReadVariant()

Returns

object

Remarks

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