问题
IS there a way to use Linq to XML in .net 2.0? I'm not sure about it, if not, how could i recode this
var doc = XDocument.Load("config.xml");
var xVideo = doc
.Element("XML")
.Element("VIDEO");
xVideo.SetElementValue("MAPTEXTURELEVEL", 8);
doc.Save("config.xml");
Without using Linq to XML?
回答1:
XmlDocument doc = new XmlDocument();
doc.Load("config.xml");
XmlNode node = doc.SelectSingleNode("/XML/VIDEO/MAPTEXTURELEVEL[1]");
node.InnerText = "8";
doc.Save("config.xml");
No, you can't use XDocument in .net 2.0
来源:https://stackoverflow.com/questions/10375038/linq-to-xml-in-net-2-0