procedure TF_XMLTrans.ColorButton1Click(Sender: TObject);
var
XMLDoc : Variant;
begin
XMLDoc := WebBrowser1.Document;
XMLStr := XMLDoc.Body.InnerText;
memo1.Clear;
memo1.lines.add(XMLStr);
row_no := 1;
infile_text := XMLStr;
Fdoc := CoDOMDocument.Create;
try
FDoc.loadXML(infile_text);
lstNodes := Fdoc.selectNodes('//orders');
if(lstNodes <> nil) then
begin
while(true) do
begin
node := lstNodes.nextNode as IXMLDOMElement;
if node = nil then break;
if StringAlignGrid1.Cells[0, 1] <> '' then
StringAlignGrid1.RowCount := StringAlignGrid1.RowCount + 1;
vVal := node.getAttribute('OrderID');
StringAlignGrid1.Cells[0,row_no] := vVal;
vVal := node.getAttribute('CustID');
StringAlignGrid1.Cells[1,row_no] := vVal;
vVal := node.getAttribute('EmpID');
StringAlignGrid1.Cells[2,row_no] := vVal;
inc(row_no);
end;
end;
finally
end;
end;
저는 이렇게 작성 했습니다.. 그런데... while안에 node에 시작부터 nil이 들어옵니다.
해결방법 좀 알려주십시요... 부탁합니다 (__)