//#######################################################################//
//## Procedure ProcessFile: ##//
//#######################################################################//
//## Datum: Änderung: ##//
//## ====== ========= ##//
//## 08.10.2003 Initial Release ##//
//#######################################################################//
procedure TForm1.ProcessFile(Filename: TFileName);
var
I: Integer;
XMLDoc: IXMLDOMDocument2;
dealer, envelope, department, extracode,
operator, article, qty: IXMLDOMNode;
Order_Nodes: IXMLDOMNodeList;
begin
// XML COM Interface laden
XMLDoc := CoDOMDocument40.Create;
XMLDoc.setProperty('
NewParser', True);
XMLDoc.load(Filename);
// Fehler überprüfen
if XMLDoc.parseError.errorCode <> 0
then
begin
ShowMessage('
XML Fehler: '#13#10 + XMLDoc.parseError.reason);
Exit;
end;
// alle Order_Nodes Nodes heranholen
Order_Nodes := XMLDoc.documentElement.selectNodes('
order-section');
for I := 0
to Pred(Order_Nodes.length)
do
begin
gauge1.maxvalue := zquery.FieldCount;
gauge1.Visible:= True;
// nodes mit inhalt heranholen
dealer := Order_Nodes.item[I].selectSingleNode('
dealer');
envelope := Order_Nodes.item[I].selectSingleNode('
envelope');
department := Order_Nodes.item[I].selectSingleNode('
department');
extracode := Order_Nodes.item[I].selectSingleNode('
extracode');
operator := Order_Nodes.item[I].selectSingleNode('
operator');
article := Order_Nodes.item[I].selectSingleNode('
article-section/article');
// hier einfach 'article-section' eingefügt...
qty := Order_Nodes.item[I].selectSingleNode('
article-section/qty');
// hier einfach 'article-section' eingefügt...
ZQuery.Insert;
// Datei in Appendmodus setzen
with ZQuery
do
begin
if Assigned(dealer)
then
FieldByName('
dealer').AsString:= dealer.text;
if Assigned(envelope)
then
FieldByName('
envelope').AsString := envelope.text;
if Assigned(department)
then
FieldByName('
department').AsString := department.text;
if Assigned(extracode)
then
FieldByName('
extracode').AsString := extracode.text;
if Assigned(
operator)
then
FieldByName('
operator').AsString:=
operator.text;
if Assigned(article)
then
FieldByName('
article').AsString:= article.text;
if Assigned(qty)
then
FieldByName('
qty').AsString:= qty.text;
gauge1.progress := gauge1.progress + 1;
end;
ZQuery.Post;
// Satz schreiben
end;
gauge1.progress := 0;
gauge1.Visible:= false;
end;