IXMLWriter Interface

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

Members

Name Description
Method LookupNamespace Obtains the declared namespace prefix for a namespace.
Method WriteBinary Writes an element value as a binary array.
Method WriteBoolean Writes an element value as a boolean.
Method WriteByte Writes an element value as a byte.
Method WriteCData Writes a CDATA section.
Method WriteDate Writes an element value as a date.
Method WriteDouble Writes an element value as a double.
Method WriteEndTag Writes the ending tag of an element.
Method WriteFloat Writes an element value as a float.
Method WriteInteger Writes an element value as a long.
Method WriteNewLine Writes a newline.
Method WriteShort Writes an element value as a short.
Method WriteStartTag Writes the starting tag of an element.
Method WriteTab Writes a tab.
Method WriteText Writes the text value of an element.
Method WriteTo Specifies output XML stream.
Method WriteVariant Writes an element value as a variant.
Method WriteXML Writes raw XML.
Method WriteXMLDeclaration Writes the XML document declaration.

IXMLWriter.LookupNamespace Method

Obtains the declared namespace prefix for a namespace.

Public Function LookupNamespace ( _
    ByVal uri As String _
) As String
public string LookupNamespace (
    string uri
);

IXMLWriter.WriteBinary Method

Writes an element value as a binary array.

Public Sub WriteBinary ( _
    ByRef Value As Byte[]& _
)
public void WriteBinary (
    ref Byte[]& Value
);

Remarks

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

IXMLWriter.WriteBoolean Method

Writes an element value as a boolean.

Public Sub WriteBoolean ( _
    ByVal Value As Boolean _
)
public void WriteBoolean (
    bool Value
);

IXMLWriter.WriteByte Method

Writes an element value as a byte.

Public Sub WriteByte ( _
    ByVal Value As Byte _
)
public void WriteByte (
    byte Value
);

IXMLWriter.WriteCData Method

Writes a CDATA section.

Public Sub WriteCData ( _
    ByVal cdata As String _
)
public void WriteCData (
    string cdata
);

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 IXMLStreamSet pXMLStream = new XMLStreamDim pXMLWriter as IXMLWriterSet pXMLWriter = new XMLWriterpXMLWriter.WriteTo pXMLStreampXMLWriter.WriteCData "if a > b & b > c, then a > c"

IXMLWriter.WriteDate Method

Writes an element value as a date.

Public Sub WriteDate ( _
    ByVal Value As DateTime _
)
public void WriteDate (
    DateTime Value
);

IXMLWriter.WriteDouble Method

Writes an element value as a double.

Public Sub WriteDouble ( _
    ByVal Value As Double _
)
public void WriteDouble (
    double Value
);

IXMLWriter.WriteEndTag Method

Writes the ending tag of an element.

Public Sub WriteEndTag ( _
)
public void WriteEndTag (
);

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.

IXMLWriter.WriteFloat Method

Writes an element value as a float.

Public Sub WriteFloat ( _
    ByVal Value As Single _
)
public void WriteFloat (
    float Value
);

IXMLWriter.WriteInteger Method

Writes an element value as a long.

Public Sub WriteInteger ( _
    ByVal Value As Integer _
)
public void WriteInteger (
    int Value
);

IXMLWriter.WriteNewLine Method

Writes a newline.

Public Sub WriteNewLine ( _
)
public void WriteNewLine (
);

IXMLWriter.WriteShort Method

Writes an element value as a short.

Public Sub WriteShort ( _
    ByVal Value As Short _
)
public void WriteShort (
    short Value
);

IXMLWriter.WriteStartTag Method

Writes the starting tag of an element.

Public Sub WriteStartTag ( _
    ByVal LocalName As String, _
    ByVal uri As String, _
    ByVal Attributes As IXMLAttributes, _
    ByVal namespaces As IXMLNamespaces, _
    ByVal isEmpty As Boolean _
)
public void WriteStartTag (
    string LocalName,
    string uri,
    IXMLAttributes Attributes,
    IXMLNamespaces namespaces,
    bool isEmpty
);

Remarks

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

IXMLWriter.WriteTab Method

Writes a tab.

Public Sub WriteTab ( _
)
public void WriteTab (
);

IXMLWriter.WriteText Method

Writes the text value of an element.

Public Sub WriteText ( _
    ByVal Text As String _
)
public void WriteText (
    string Text
);

Remarks

The WriteText method writes the text value of an element.

IXMLWriter.WriteTo Method

Specifies output XML stream.

Public Sub WriteTo ( _
    ByVal outputStream As IStream _
)
public void WriteTo (
    IStream outputStream
);

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 IXMLWriterSet pWriter = New XMLWriterDim pXMLStream as IXMLStreamSet 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"

IXMLWriter.WriteVariant Method

Writes an element value as a variant.

Public Sub WriteVariant ( _
    ByVal Value As Object _
)
public void WriteVariant (
    object Value
);

Remarks

The WriteVariant method writes an element value as a variant.

IXMLWriter.WriteXML Method

Writes raw XML.

Public Sub WriteXML ( _
    ByVal XML As String _
)
public void WriteXML (
    string 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.

IXMLWriter.WriteXMLDeclaration Method

Writes the XML document declaration.

Public Sub WriteXMLDeclaration ( _
)
public 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.

Classes that implement IXMLWriter

Classes Description
XMLWriter An XML sequential document writer.

Remarks

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

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.