XML删除未含有条件的子节点
<power_line>
<name>嘉华305线 </name>
<sap_id>5020-S-0000-0065 </sap_id>
<dydj>35kV </dydj>
<poles>
<pole>
<name>嘉华305线电缆电缆#0 </name>
<xh>0 </xh>
<sap_id>000000000040719166 </sap_id>
</pole>
<pole>
<name>嘉华305线电缆支架 </name>
<xh>0 </xh>
<sap_id>000000000040627384 </sap_id>
<jd>120.7071280158 </jd>
<wd>30.6240158394 </wd>
</pole>
<pole>
<name>嘉华305线电缆电缆#1 </name>
<xh>1 </xh>
<sap_id>000000000040716119 </sap_id>
</pole>
</poles>
</power_line>
我想把不含有 <jd>的子节点都删除掉.请问要怎么做?
遍历 pole + 判断 删除...
或者:
C# code:
using System;
using System.Diagnostics;
using System.Xml;
namespace ConsoleApplication9 {
class Program {
static void Main() {
string xml = @"
<power_line>
<name>嘉华305线 </name>
<sap_id>50
相关问答:
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式文件
<folder state="unchecked" label="全部">
<folder state="unchecked" isBra ......
<?xml version="1.0" encoding="utf-8" ?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical&q ......
<?xml version="1.0" encoding="utf-8" ?>
<HuiSin>
<admin>100,100</admin>
<user>200,200</user>
怎样在这里添加一个新的呢?
< ......
远程读取
C# code:
XmlReader xmlReader = XmlReader.Create("http://google.com/complete/search?output=toolbar&q="+Keyword);
XML内容为
XML code:
<?xml version="1.0" ......