ArcObjects Library Reference (System)  

IXMLWriter.WriteCData Method

Writes a CDATA section.

[Visual Basic .NET]
Public Sub WriteCData ( _
    ByVal cdata As String _
)
[C#]
public void WriteCData (
    string cdata
);
[C++]
HRESULT WriteCData(
  BSTR cdata
);
[C++]

Parameters

cdata [in]   cdata is a parameter of type BSTR

Product Availability

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

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"

See Also

IXMLWriter Interface