Hello;
when I create xml file in C#, the file Created is in one line
My Question : How to create an xml file in several line format;
thank you
Hello;
when I create xml file in C#, the file Created is in one line
My Question : How to create an xml file in several line format;
thank you
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted May 20, 2009, 7:32 AM
thanks for your response
but, I will create xml file from a list of string and I must respect this format
<
MarkUp name="string1">Cdata1]]>MarkUp><
MarkUp name="string2">Cdata1]]>MarkUp><
MarkUp name="string2">Cdata1]]>MarkUp><
MarkUp name="string2">Cdata1]]>MarkUp><
MarkUp name="string2">Cdata1]]>MarkUp>my question : how to add attribut and CDATA section in xml file already existing
thanks
Vijay JadhavPosted May 20, 2009, 6:41 AM
Your question is very unclear.
But, if you want to create Xml file from desired string then following snippet will help you :
#region Create Xml File
/*----------------------- Create Xml String To Xml File ------------------------*/
private void CreateXmlFile(string sStudentXml)
{
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(sStudentXml);
doc.Save(Server.MapPath("XmlFiles\\ReadXml.xml"));
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
Also here is some tutorial :
1) http://www.c-sharpcorner.com/UploadFile/mahesh/writexmlusingXmlWriter11132005233450PM/writexmlusingXmlWriter.aspx
2) http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx
Hope, this will help you.
Thanks.