You can try like so with double quotes:
Dim outerXml as String = Replace(objXml.OuterXml(), "<MID>someText</MID>", "<MID><![CDATA[<a href=""https://www.google.com"">Click me</a>]]></MID>")
or
Dim outerXml as String
outerXML = Replace(objXml.OuterXml(), "<MID>someText</MID>", "<MID><![CDATA[<a href=""https://www.google.com"">Click me</a>]]></MID>")
You could also use xml.WriteCdata with xml writer
https://learn.microsoft.com/en-us/dotnet/api/system.xml.xmlwriter.writecdata?view=netframework-4.8
I am programming in VB. And currently displaying some XML on a Webpage.
I would like to display a clickable link. So I tried:
Dim objXml As System.Xml.XmlDocument = New System.Xml.XmlDocument
objXml.LoadXml(pInfo.AsXml)
Dim outerXML = Replace(objXml.OuterXml(), "<MID>someText</MID>", "<MID><![CDATA[<a href='https://www.google.com'>Click me</a>]]></MID>")
But it actually displays just all the text and does not format the html inside CDATA:
<MID><a href='https://www.google.com'>Click me</a></MID>
All it should display is:
<MID>Click me</MID>
Any ideas why this is not working?