How to save an xml-string into an Xml document

Platform: ASP.NET| Category: XML

VB.NET


Dim xmlText As String = 'Node1Node2'
Dim xmlDoc As New XmlDocument
xmlDoc.LoadXml(xmlText)
Dim writer As XmlTextWriter = New XmlTextWriter(Server.MapPath('data.xml'), Nothing)
writer.Formatting = Formatting.Indented
xmlDoc.Save(writer)

C#


string xmlText = 'Node1Node2';
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlText);
XmlTextWriter writer = new XmlTextWriter(Server.MapPath('data.xml'),null);
writer.Formatting = Formatting.Indented;
xmlDoc.Save(writer);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.