Delphi Xml Read Cant读取NextSibling

时间:2013-05-24 14:16:33

标签: xml delphi

Myxml文件就像这样

<DATAPACKET>
          <ROWDATA>
             <LINE1>
               <ROW Attr1="111" Attr2="2121" />
             </LINE1>
             <LINE2>
               <ROW At1="11" At2="2211" />
             </LINE2>
           </ROWDATA>
          <ROWDATA>
             <LINE1>
               <ROW Attr1="333" Attr2="2121" />
             </LINE1>
             <LINE2>
               <ROW At1="11" At2="2211" />
             </LINE2>
           </ROWDATA>
....
</DATAPACKET>

和我解析它的代码
我使用delphi7和TXMLDocument

Rows := MyXml.DocumentElement.ChildNodes.First ;//Get first rowdata
Line1 := Rows.ChildNodes.First ;    // then first line1
Curnode := Line1.ChildNodes.First ;  // 
For kk := 0 To Rows.ChildNodes.Count-1 Do Begin
    if (Curnode.Attributes['Attr1'] <> null) then
         Form1.Memo1.Lines.Add(CurNode.Attributes['Attr1']) ;
    Curnode := Rows.NextSibling;
End ;

它只读111 但不能333和......

最好的问候

0 个答案:

没有答案