在一个xml里有很多数据
……
<Student age = 12>
<Student age1 = 13>
<Student age2 = 15>
<Student age3 = 21>
<Student age4 = 11>
<Student age5 = 31>
<Student age6 = 61>
……
如何能检测的到age是否存在?试了些办法都不能达到要求

解决方案 »

  1.   

    if Node.AttributeByName['age'] = nil then ....
      

  2.   

    你这情况通过索引来判断就行了
    if Node.Attributes[0] = nil then ....
      

  3.   

    那应该是你代码有问题,我这里XE + NativeXML 3.29测试通过
      

  4.   

    Node.Attributes[0] = nil  判断第一个是否为空?Node.AttributeByName['age'] = nil  ?哪个能不用for直接索引到的有吗?我现在是for 2次  在里面的for里 Findnode 如果没搜索到就认为为空