假设我有一个如下的 xml 文件
<DataBaseServers>
<DataBaseServer id="1" title="IISDevdb1" address="Address1">
<DataBases>
<database id="1" name="db1" userID="u1" password="p1" />
<database id="3" name="db3" userID="u3" password="p3" />
</DataBases>
</DataBaseServer>
<DataBaseServer id="2" title="iis2" address="Address2">
<DataBases>
<database id="2" name="db2" userID="u2" password="p2" />
</DataBases>
</DataBaseServer>
</DataBaseServers>
我想删除数据库 id="3"。
生成的 xml 将是
<DataBaseServers>
<DataBaseServer id="1" title="IISDevdb1" address="Address1">
<DataBases>
<database id="1" name="db1" userID="u1" password="p1" />
</DataBases>
</DataBaseServer>
<DataBaseServer id="2" title="iis2" address="Address2">
<DataBases>
<database id="2" name="db2" userID="u2" password="p2" />
</DataBases>
</DataBaseServer>
</DataBaseServers>
如果我删除数据库 id="2",xml 将看起来像
<DataBaseServers>
<DataBaseServer id="1" title="IISDevdb1" address="Address1">
<DataBases>
<database id="1" name="db1" userID="u1" password="p1" />
<database id="3" name="db3" userID="u3" password="p3" />
</DataBases>
</DataBaseServer>
<DataBaseServer id="2" title="iis2" address="Address2"/>
</DataBaseServers>
我怎样才能使用 XDocument 做到这一点?