0

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 和...

此致

4

0 回答 0