Class XMLWriterClass

Namespace
ESRI.ArcGIS.esriSystem
Assembly
ESRI.Server.System.dll
[ClassInterface(ClassInterfaceType.None)]
[Guid("105A5345-85F8-4B27-A1D2-5D2262C6D27E")]
public class XMLWriterClass : XMLWriter, IXMLWriter2, IXMLWriter, ISupportErrorInfo
Inheritance
XMLWriterClass
Implements
Inherited Members

Constructors

XMLWriterClass()

public XMLWriterClass()

Explicit Interface Implementations

IXMLWriter2_LookupNamespace(string)

virtual string IXMLWriter2_LookupNamespace(string uri)

Parameters

uri string

Returns

string

IXMLWriter2_WriteBinary(ref byte[])

virtual void IXMLWriter2_WriteBinary(ref byte[] Value)

Parameters

Value byte[]

IXMLWriter2_WriteBoolean(bool)

virtual void IXMLWriter2_WriteBoolean(bool Value)

Parameters

Value bool

IXMLWriter2_WriteByte(byte)

virtual void IXMLWriter2_WriteByte(byte Value)

Parameters

Value byte

IXMLWriter2_WriteCData(string)

virtual void IXMLWriter2_WriteCData(string cdata)

Parameters

cdata string

IXMLWriter2_WriteDate(DateTime)

virtual void IXMLWriter2_WriteDate(DateTime Value)

Parameters

Value DateTime

IXMLWriter2_WriteDouble(double)

virtual void IXMLWriter2_WriteDouble(double Value)

Parameters

Value double

IXMLWriter2_WriteEndTag()

virtual void IXMLWriter2_WriteEndTag()

IXMLWriter2_WriteFloat(float)

virtual void IXMLWriter2_WriteFloat(float Value)

Parameters

Value float

IXMLWriter2_WriteInteger(int)

virtual void IXMLWriter2_WriteInteger(int Value)

Parameters

Value int

IXMLWriter2_WriteNewLine()

virtual void IXMLWriter2_WriteNewLine()

IXMLWriter2_WriteShort(short)

virtual void IXMLWriter2_WriteShort(short Value)

Parameters

Value short

IXMLWriter2_WriteStartTag(string, string, IXMLAttributes, IXMLNamespaces, bool)

virtual void IXMLWriter2_WriteStartTag(string LocalName, string uri, IXMLAttributes Attributes, IXMLNamespaces namespaces, bool isEmpty)

Parameters

LocalName string
uri string
Attributes IXMLAttributes
namespaces IXMLNamespaces
isEmpty bool

IXMLWriter2_WriteTab()

virtual void IXMLWriter2_WriteTab()

IXMLWriter2_WriteText(string)

virtual void IXMLWriter2_WriteText(string Text)

Parameters

Text string

IXMLWriter2_WriteTo(IStream)

virtual void IXMLWriter2_WriteTo(IStream outputStream)

Parameters

outputStream IStream

IXMLWriter2_WriteVariant(object)

virtual void IXMLWriter2_WriteVariant(object Value)

Parameters

Value object

IXMLWriter2_WriteXML(string)

virtual void IXMLWriter2_WriteXML(string XML)

Parameters

XML string

IXMLWriter2_WriteXMLDeclaration()

virtual void IXMLWriter2_WriteXMLDeclaration()

InterfaceSupportsErrorInfo(ref Guid)

virtual void InterfaceSupportsErrorInfo(ref Guid riid)

Parameters

riid Guid

LookupNamespace(string)

Obtains the declared namespace prefix for a namespace.

virtual string LookupNamespace(string uri)

Parameters

uri string

Returns

string

Stream

Obtains underlying stream. If WriteTo() is not called yet, will return NULL.

virtual IStream Stream { get; }

Returns

IStream

WriteBinary(ref byte[])

Writes an element value as a binary array.

virtual void WriteBinary(ref byte[] Value)

Parameters

Value byte[]

Remarks

The WriteBinary method writes an element value as a binary array.

WriteBoolean(bool)

Writes an element value as a boolean.

virtual void WriteBoolean(bool Value)

Parameters

Value bool

WriteByte(byte)

Writes an element value as a byte.

virtual void WriteByte(byte Value)

Parameters

Value byte

WriteCData(string)

Writes a CDATA section.

virtual void WriteCData(string cdata)

Parameters

cdata string

Remarks


All text inside XML document is parsed by the XML parser. Only the text inside the CDATA section is ignored by the parser. If your text has lots of "<", ">", "&", "'", and "" (like program code), it could be hidden in CDATA section.

For example,

<test>
  <![CDATA[
  if a > b & b > c, then a > c
  ]]>   
</test>

In the example above, everything inside CDATA section was ignored by the parser. It would show <test>if a > b & b > c, then a > c</test> in any web browser. 

Example of creating such CDATA section using IXMLWriter:

  Dim pXMLStream as IXMLStream
  Set pXMLStream = new XMLStream

  Dim pXMLWriter as IXMLWriter
  Set pXMLWriter = new XMLWriter

  pXMLWriter.WriteTo pXMLStream

  pXMLWriter.WriteCData "if a > b & b > c, then a > c"






















WriteDate(DateTime)

Writes an element value as a date.

virtual void WriteDate(DateTime Value)

Parameters

Value DateTime

WriteDouble(double)

Writes an element value as a double.

virtual void WriteDouble(double Value)

Parameters

Value double

WriteEndTag()

Writes the ending tag of an element.

virtual void WriteEndTag()

WriteFloat(float)

Writes an element value as a float.

virtual void WriteFloat(float Value)

Parameters

Value float

WriteInt64(long)

Writes an element value as an int64.

virtual void WriteInt64(long Value)

Parameters

Value long

WriteInteger(int)

Writes an element value as a long.

virtual void WriteInteger(int Value)

Parameters

Value int

WriteNewLine()

Writes a newline.

virtual void WriteNewLine()

WriteShort(short)

Writes an element value as a short.

virtual void WriteShort(short Value)

Parameters

Value short

WriteStartTag(string, string, IXMLAttributes, IXMLNamespaces, bool)

Writes the starting tag of an element.

virtual void WriteStartTag(string LocalName, string uri, IXMLAttributes Attributes, IXMLNamespaces namespaces, bool isEmpty)

Parameters

LocalName string
uri string
Attributes IXMLAttributes
namespaces IXMLNamespaces
isEmpty bool

Remarks


The WriteStartTag method specifies the starting tag of an element.
For example:

<Length>

 





WriteTab()

Writes a tab.

virtual void WriteTab()

WriteText(string)

Writes the text value of an element.

virtual void WriteText(string Text)

Parameters

Text string

Remarks

The WriteText method writes the text value of an element.

WriteTo(IStream)

Specifies output XML stream.

virtual void WriteTo(IStream outputStream)

Parameters

outputStream IStream

Remarks


The WriteTo method specifies the output XML stream. XMLStream lets you write/read (in our case write) xml data to stream object.

For Example:

Dim pWriter As IXMLWriter
Set pWriter = New XMLWriter

Dim pXMLStream as IXMLStream
Set pXMLStream = new XMLStream

'*** This sets output to XML Stream ***
pWriter.WriteTo pStream

'*** Write some xml to the stream ***
pWriter.WriteXMLDeclaration

'*** Save stream to the file ***
pXMLStream.SaveToFile App.Path & "\new.xml"

















WriteVariant(object)

Writes an element value as a variant.

virtual void WriteVariant(object Value)

Parameters

Value object

Remarks

The WriteVariant method writes an element value as a variant.

WriteXML(string)

Writes raw XML.

virtual void WriteXML(string XML)

Parameters

XML string

Remarks

The RawXML method writes XML code to Stream object. The XML code should be well-formed and valid, otherwise the XMLReader will raise error if the Stream is going to be read afterwards.

WriteXMLDeclaration()

Writes the XML document declaration.

virtual void WriteXMLDeclaration()

Remarks


The WriteXMLDeclaration writes

<?xml version="1.0" encoding="utf-8" ?>

to Stream object. XML Declaration should always be included, as it defines the XML version and the encoding of the document.