Hi
I am trying to post-process some XML-documents from some third-party
software.
I open them, find the right element, manipulate the text and write it back
to the element.
Dim x As New Xml.XmlDocument
Dim nl As Xml.XmlNodeList
Dim text As String
Dim textOutput As String
x.Load(filename)
nl = x.GetElementsByTagName("text")
[snip, some manipulation of the text, not important...]
nl.Item(0).InnerText = "<![CDATA[ " & textOutput & " ]]>"
'nl.Item(0).InnerText = textOutput
x.Save("C:\Temp\XmlYt.xml")
Now, the data I write back is encoded and not enclosed in CDATA. I tried
addding the CDATA-myself, but that just gets encoded as well.
Before:
<text><![CDATA[<block><p x1="294" y1="602" x2="795" y2="1105">HORSENS - I
morgen kan være AaB's sidste dag som tophold i superligaen i denne
sæson.</p><p x1="294" y1="602" x2="795" y2="1105">AC Horsens kan sende AaB
ned fra førstepladsen, såfremt FCK to timer senere vinder hjemmekampen mod
FC Midtjylland.</p><p x1="294" y1="602" x2="795" y2="1105">AaB var et af de
svageste hold i superligaen i foråret.</p
</block>]]></text>
<text><![CDATA[ <p x1="294" y1="602" x2="795" y2="1105">HORSENS - I
morgen kan være AaB's sidste dag som tophold i superligaen i denne
sæson.</p>
<p x1="294" y1="602" x2="795" y2="1105">AC Horsens kan sende AaB ned
fra førstepladsen, såfremt FCK to timer senere vinder hjemmekampen mod FC
Midtjylland.</p>
<p x1="294" y1="602" x2="795" y2="1105">AaB var et af de svageste hold
i superligaen i foråret.</p>
</p>
]]></text>
How do I avoid the encoding and enclose the text in CDATA-tags?