可能的重复:
解析 xml 文件的最佳实践? https://stackoverflow.com/questions/55828/best-practices-to-parse-xml-files
我希望能够在 XML 文档中搜索特定元素,然后获取该元素中的所有内容,并使用 C# 将元素中的每个新行存储到字符串数组中。我该怎么做呢?
XDocument xdoc = XDocument.Load("file.xml"));
var elm = from element in xdoc.Descendants("element")
select new {
attribute = element.Attribute("attribute").Value,
};
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)