Mega Code Archive

 
Categories / VB.Net / XML
 

Set InnerXml to a string that includes markup

Imports System Imports System.Xml public class Test   public shared sub Main()     Dim doc as XmlDocument = new XmlDocument()     doc.LoadXml("<root>"& _                 "<elem>some text<child/>more text</elem>" & _                 "</root>")     Dim elem as XmlElement     elem = CType (doc.DocumentElement.ChildNodes.Item(0), XmlElement)     elem.InnerXml = "Text containing <markup/>."     Console.WriteLine( elem.OuterXml )   end sub end class