Tuesday, 21 July 2015

Xml Techniques(Convert datatable to xml formate along with schema)

(1)Convert datatable to xml formate with schema and withought schema in C#.Net
======================================================================
 DataTable ResultSerWithMiddleSerchText = new DataTabl();
System.IO.StringWriter writer = new System.IO.StringWriter();
(a) with schema
---------------------------------------------------------------------------------------
ResultSerWithStartSerchText.WriteXml(writer, XmlWriteMode.WriteSchema, true);
string resultData = writer.ToString();

(b) with out schema
---------------------------------------------------------------------------------------
ResultSerWithStartSerchText.WriteXml(writer, XmlWriteMode.WriteSchema, false);
string resultData = writer.ToString();

No comments:

Post a Comment