关于XML文件的.已知一个属性,如何返回节点. ( 积分: 30 )

Y

yyacc

Unregistered / Unconfirmed
GUEST, unregistred user!
比如
<Connections><Connection id="1" " name="Connection1"/ ...>
<Connection id="2" name="Connection2"/ ...>
<Connection id="3" name="Connection3"/ ...>
</Connections>
如果我只要确定取出了Connection2,就要取出有关于这一个节点的所有属性.
怎么取呢?
 
上面那个功能我解决了.
但是现在我想要删除
<Connection id="2" name="Connection2"/ ...>
怎么删除.
为什么我删除了后总是剩下一个空的结点呢?比如把上句删了都会留下这个<Connection/>
if child_node.Attributes['name']=s then
parent_node.ChildNodes.Delete(child_node.ParentNode.ChildNodes.IndexOf(child_node));
或者
if child_node.Attributes['name']=s then
parent_node.ChildNodes.Remove(child_node);
都会剩下那个空的结点.哪位有什么好办法.回答了立即给分.
 

Similar threads

I
回复
0
查看
736
import
I
I
回复
0
查看
611
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部