Monday, August 5, 2013

Convert String to XML

A simple way to convert a string to XML is as follows:
string xmlContent = "<ViewFields><FieldRef Name=\"ID\" /><FieldRef Name=\"Title\" /></ViewFields>";
XmlDocument nd = new XmlDocument();
nd.LoadXml(xmlContent);
XmlNode viewFields = nd.DocumentElement;
In this example we drill down deeper to get an XmlNode (used for querying SP lists).

No comments:

Post a Comment