易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关问答:

vb读取用word转换成的xml里的数据 - VB / 基础类

Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' 打开刚创建的文件。
ReDim MyString(LOF(1) - 1)
  Put #1, , MyRecord ' 读入所有字符到变量中 ......

c#生成xml文件 - .NET技术 / C#

思路:要用c#生成一个播放机的播放列表的xml,例如:
<daty datys='2010-04-05' datye='2010-05-01' > //这是播放的日期段
  <time times='01:12:00' timee='02:30:00'> ......

XmlDocument如何生成闭合标记的XML - .NET技术 / C#

我用XmlDocument生成XML
XmlElement remarkNode = node.OwnerDocument.CreateElement("remark");
remark1Node.InnerXml = "";
如果InnerXml赋值不为空,则生成的标记是没问题的,比如:<r ......

SQL server分解XML - MS-SQL Server / 应用实例

下面是XML初始文件内容
XML code:
<upd:Update xmlns:lar="http://schemas.microsoft.com/msus/2002/12/LogicalApplicabilityRules" xmlns:cmd="http://schemas.microsoft.com/msus/2002/12/Up ......

XML 的读写 - Web 开发 / XML/SOAP

<?xml version="1.0" encoding="utf-8" ?>
<HuiSin>
  <admin>100,100</admin>
  <user>200,200</user>
怎样在这里添加一个新的呢?
< ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号