【发布时间】:2009-12-29 21:31:05
【问题描述】:
我想修改 XSD 中的一个节点。我想更改此节点中的“名称”值:
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
但是,当我尝试通过此代码查找该节点时,我没有收到任何节点或出现错误,具体取决于我的尝试。
xsdDoc.Descendants("element").Where(x => x.Attribute("name").Value == "NewDataSet").Single().SetAttributeValue("name", "newValue");
Linq To Xsd 不是一个选项,因为它看起来像是开源的,这意味着各种繁文缛节(在工作中)。
这是可能的,还是我不走运?
相关(但不相同):Linq to XML - update/alter the nodes of an XML Document
【问题讨论】:
标签: linq linq-to-xml