现在的代码:
uses
XMLIntf, XMLDoc XMLDocument :IXMLDocument;
XMLNode, XMLNode2:IXMLNode; XMLDocument := XMLDoc.TXMLDocument.Create( 'E:\test.xml' );
XMLDocument.Active := True;
XMLNode := XMLDocument.DocumentElement;
for i:=0 to XMLNode.ChildNodes.Count-1 do
begin
XMLNode2:=XMLNode.ChildNodes.Get(i);
for j := 0 to XMLNode2.AttributeNodes.Count-1 do
begin
....
end;
end; XMLDocument.Active:=False;
XMLNode2:=Nil;
XMLNode:=Nil;
XMLDocument:=Nil;
uses
XMLIntf, XMLDoc XMLDocument :IXMLDocument;
XMLNode, XMLNode2:IXMLNode; XMLDocument := XMLDoc.TXMLDocument.Create( 'E:\test.xml' );
XMLDocument.Active := True;
XMLNode := XMLDocument.DocumentElement;
for i:=0 to XMLNode.ChildNodes.Count-1 do
begin
XMLNode2:=XMLNode.ChildNodes.Get(i);
for j := 0 to XMLNode2.AttributeNodes.Count-1 do
begin
....
end;
end; XMLDocument.Active:=False;
XMLNode2:=Nil;
XMLNode:=Nil;
XMLDocument:=Nil;
http://home.iprimus.com.au/kbwood/DelphiXML/BookCode/Chapter%2014/
除了楼上介绍的SAX for Pascal外,MSXML4.0也能做SAX解析。