void Main()
{
String aciResponseData = "<?xml version="1.0" encoding="UTF-8"?><tag><bar>test</bar></tag>";
using(TextReader sr = new StringReader(aciResponseData))
{
var serializer = new System.Xml.Serialization.XmlSerializer(typeof(MyClass));
MyClass response = (MyClass)serializer.Deserialize(sr);
Console.WriteLine(response.bar);
}
}
[System.Xml.Serialization.XmlRoot("tag")]
public class MyClass
{
public String bar;
}
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("your file path");
C# object to xml document
XmlDocument xdDoc = new XmlDocument();
xdDoc.Load("blah/blah.csproj");
XmlNamespaceManager xnManager =
new XmlNamespaceManager(xdDoc.NameTable);
xnManager.AddNamespace("tu",
"http://schemas.microsoft.com/developer/msbuild/2003");
XmlNode xnRoot = xdDoc.DocumentElement;
XmlNodeList xnlPages = xnRoot.SelectNodes("//tu:ItemGroup", xnManager);