I use ASP.net VB.net to write a XML file.
In one of the element which is called "Description" i have to add a "<![CData[Class : <b>Class Name</b><br>Price: 100,000.00]]>
".
Using,
strDes = "<![CDATA[Class : <b>" + myReader.GetSqlValue(4).ToString +
"</b><br>Price: " + myReader.GetSqlValue(7).ToString + "]]>"
XMLwrite.WriteElementString("description", strDes.ToString)
But when i generate the XML file, it gives
<description><![CDATA[Class : <b>Residential - Site Built</b><br>Price: 100,000.00]]></description>
You should always use the XML APIs to create XML. The CDATA you were generating should have been generated by the XmLWriter API. Try this:
strDes = "Class : <b>" + myReader.GetSqlValue(4).ToString + _
"</b><br>Price: " + myReader.GetSqlValue(7).ToString
XMLwrite.WriteStartElement("description")
XMLwrite.WriteCData(strDes);
XMLwrite.WriteEndElement();