//#######################################################################//
//## Procedure ProcessFile: ##//
//#######################################################################//
//## Datum: Änderung: ##//
//## ====== ========= ##//
//## 08.10.2003 Initial Release ##//
//#######################################################################//
procedure TForm1.ProcessFile(Filename: TFileName);
var
I: Integer;
XMLDoc: IXMLDOMDocument2;
dealer, envelope, department, extracode,
operator: 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
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');
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;
end;
ZQuery.Post;
// Satz schreiben
end;
end;