0
这是我的xml文件:我怎么能找到,如果一个子节点存在
<?xml version="1.0" encoding="utf-8"?>
<UsersF Ver="1.1">
<row User="1" Pin="2y44ic" ExtPag="full"/>
<row User="2" pin="tfde88" ExtPag="e45" />
<row User="3" Pin="9gr444466gg" Level="nov" GamePag="3" />
</UsersF>
这是我得到的访问,并把一个字符串电网代码... 我用的是nextgrid ...
procedure showXmlToString;
Count:= 0;
Conf.nxtgrd.AddRow(71);
Conf.nxtgrd.BeginUpdate;
with FXml.Root do
for i := 0 to NodeCount - 1 do
begin
if Nodes[i].Name <> 'Ver' then
begin
Conf.nxtgrd.Cell[0,count].AsString := Nodes[i].Nodes[1].Value;
Conf.nxtgrd.Cell[1,count].AsString := Nodes[i].Nodes[2].Value;
Conf.nxtgrd.Cell[2,count].AsString := Nodes[i].Nodes[3].Value;
Conf.nxtgrd.Cell[3,count].AsString := Nodes[i].Nodes[4].Value;
count := count + 1;
end;
end;
当发现节点不存在时,我得到错误。
不,它不工作... bcs行节点中不存在相同的节点... – azrael11
oooh ..你的意思是检查属性(用户,别针,级别..),你可以使用'TXmlNode.AttributeCount'使用'TXmlNode.AttributeValue'迭代和检索属性值。 – sybond
是我的意思是属性... txmlnode.attributecount是错误的bcs有些时候给了我相同的数字,但不告诉我哪个节点丢失... – azrael11