Friday, 13 September 2013

How can i pass List response as an xml document using c#

How can i pass List response as an xml document using c#

I would like to pass an List response as an xml document and want to load
it as xml. Currently i am performing it using this code :
List<string> BugWSResponseList1 = new List<string>();
BugWSResponseList1 =
CreateBugs(FilePath_EXPRESS_API_BugAdd_CreateBugs_DataFile, newValue);
XmlDocument xd = new XmlDocument();
//string s = string.Join(",", BugWSResponseList2);
//xd.LoadXml(s);
string s = "<Bugs>" + string.Join(",",
BugWSResponseList1) + "</Bugs>";
xd.LoadXml(s);
//Dictionary Creation for Benchmark API
XmlDocument ResponseNode_bugs = null;
ResponseNode_bugs = new
DrWatsonCore().LoadXMLDocument(s);
I would like to avoid to convert the List<string> response to string first
and then loading it as xml. Please suggest how can i achieve that.

No comments:

Post a Comment