Altova Mailing List Archives

Re: CDATA tag missing even if specified

From: Martin Honnen <mahotrash@-----.-->
Date: 5/13/2009 3:14:00 PM
rodv wrote:
> Hello group, i have to pieces of VB6 code, that add a CDATA section to an 
> element
> Here are the excerpt of the relevant code
> Dim goXMLOutPutRegUninstallDoc As New MSXML2.DOMDocument
> Dim OutputString As String
> Dim OutputBody As IXMLDOMCDATASection
> Set goXMLOutPutRegUninstallOutput = 
> goXMLOutPutRegUninstallDoc.createElement("RegUninstalloutput")
>     Set OutputBody = 
> goXMLOutPutRegUninstallDoc.createCDATASection("___TEST")
>     goXMLOutPutRegUninstallOutput.appendChild OutputBody
> The problem is the CDATA tag is not added ! i really dont know why ?
> maybe someone could shed some light on this.

Consider to post a minimal but complete sample that allows us to 
reproduce the problem. At least explain how you check that the CDATA 
section has been added.
I have no problems with the following code:

Set doc = CreateObject("Msxml2.DOMDocument.3.0")
Set el = doc.createElement("foo")
el.appendChild doc.createCDATASection("a < b && b < c")
WScript.Echo el.xml

It outputs

<foo><![CDATA[a < b && b < c]]></foo>


	Martin Honnen --- MVP XML


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.