com.esri.arcgis.system
Interface IXMLWriter

All Superinterfaces:
Serializable
All Known Implementing Classes:
XMLWriter

public interface IXMLWriter
extends Serializable

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

Remarks

The IXMLWriter interface provides nineteen methods to use for writing out specific data elements.

Product Availability

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


Method Summary
 String lookupNamespace(String uri)
          Obtains the declared namespace prefix for a namespace.
 void writeBinary(byte[] value)
          Writes an element value as a binary array.
 void writeBoolean(boolean value)
          Writes an element value as a boolean.
 void writeByte(byte value)
          Writes an element value as a byte.
 void writeCData(String cdata)
          Writes a CDATA section.
 void writeDate(Date value)
          Writes an element value as a date.
 void writeDouble(double value)
          Writes an element value as a double.
 void writeEndTag()
          Writes the ending tag of an element.
 void writeFloat(float value)
          Writes an element value as a float.
 void writeInteger(int value)
          Writes an element value as a long.
 void writeNewLine()
          Writes a newline.
 void writeShort(short value)
          Writes an element value as a short.
 void writeStartTag(String localName, String uri, IXMLAttributes attributes, IXMLNamespaces namespaces, boolean isEmpty)
          Writes the starting tag of an element.
 void writeTab()
          Writes a tab.
 void writeText(String text)
          Writes the text value of an element.
 void writeTo(IStream outputStream)
          Specifies output XML stream.
 void writeVariant(Object value)
          Writes an element value as a variant.
 void writeXML(String xML)
          Writes raw XML.
 void writeXMLDeclaration()
          Writes the XML document declaration.
 

Method Detail

writeTo

void writeTo(IStream outputStream)
             throws IOException,
                    AutomationException
Specifies output XML stream.

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"

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
outputStream - 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.

writeStartTag

void writeStartTag(String localName,
                   String uri,
                   IXMLAttributes attributes,
                   IXMLNamespaces namespaces,
                   boolean isEmpty)
                   throws IOException,
                          AutomationException
Writes the starting tag of an element.

Remarks


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

<Length>

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
localName - The localName (in)
uri - The uri (in)
attributes - A reference to a com.esri.arcgis.system.IXMLAttributes (in)
namespaces - A reference to a com.esri.arcgis.system.IXMLNamespaces (in)
isEmpty - The isEmpty (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeText

void writeText(String text)
               throws IOException,
                      AutomationException
Writes the text value of an element.

Remarks

The WriteText method writes the text value of an element.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeCData

void writeCData(String cdata)
                throws IOException,
                       AutomationException
Writes a CDATA section.

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"

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeEndTag

void writeEndTag()
                 throws IOException,
                        AutomationException
Writes the ending tag of an element.

Description


The WriteEndTag method specifies the end tag of an element.
For example:

</Length>

If the WriteStartTag method was called with the parameter "IsEmpty" set to True, the WriteEndTag method will not be executed, and the Error will be raised. The WriteStartTag method needs to specify that the Start Tag is not going to be Empty in order to call the WriteEndTag method.

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.

writeBoolean

void writeBoolean(boolean value)
                  throws IOException,
                         AutomationException
Writes an element value as a boolean.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeByte

void writeByte(byte value)
               throws IOException,
                      AutomationException
Writes an element value as a byte.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
value - An unsigned byte (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeShort

void writeShort(short value)
                throws IOException,
                       AutomationException
Writes an element value as a short.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeInteger

void writeInteger(int value)
                  throws IOException,
                         AutomationException
Writes an element value as a long.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeFloat

void writeFloat(float value)
                throws IOException,
                       AutomationException
Writes an element value as a float.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeDouble

void writeDouble(double value)
                 throws IOException,
                        AutomationException
Writes an element value as a double.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeDate

void writeDate(Date value)
               throws IOException,
                      AutomationException
Writes an element value as a date.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeBinary

void writeBinary(byte[] value)
                 throws IOException,
                        AutomationException
Writes an element value as a binary array.

Remarks

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

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Parameters:
value - An unsigned byte (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeVariant

void writeVariant(Object value)
                  throws IOException,
                         AutomationException
Writes an element value as a variant.

Remarks

The WriteVariant method writes an element value as a variant.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeXML

void writeXML(String xML)
              throws IOException,
                     AutomationException
Writes raw XML.

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.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

writeXMLDeclaration

void writeXMLDeclaration()
                         throws IOException,
                                AutomationException
Writes the XML document declaration.

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.

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.

writeNewLine

void writeNewLine()
                  throws IOException,
                         AutomationException
Writes a newline.

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.

writeTab

void writeTab()
              throws IOException,
                     AutomationException
Writes a tab.

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.

lookupNamespace

String lookupNamespace(String uri)
                       throws IOException,
                              AutomationException
Obtains the declared namespace prefix for a namespace.

Product Availability

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

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