...
begin
metaFlag: True;
filePath := '
C:\xmlTest\';
xmlDoc := TXMLDocument.Create(
nil);
xmlDoc.Active := True;
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
SetLength(row, myQuery.RecordCount);
for R := 0
to myQuery.RecordCount-1
do begin
row[R, 0] := myQuery.FieldByName('
key_1').asString;
row[R, 1] := myQuery.FieldByName('
key_2').asString;
row[R, 2] := myQuery.FieldByName('
key_3').asString;
row[R, 3] := myQuery.FieldByName('
key_4').asString;
myQuery.next;
end;
for J := 0
to high(row)
do begin
for S := 0
to high(saisons)
do begin
if AktSA <> row[0]
then begin
if AktSA <> '
'
then begin
writeFlag = True;
end;
AktSA = row[0];
end;
fileName := filePath + row[3] + '
_' + AktSA + '
.xml';
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
Form1.Memo1.Lines.Add(sLineBreak);
Form1.Memo1.Lines.Add(myQuery.SQL.Text);
Form1.Memo1.Lines.Add(IntToStr(myQuery.RecordCount) + '
Ergebnisse');
feingehalt := myQuery.FieldByName('
somekey_1').AsString;
bf_kuerzel := myQuery.FieldByName('
somekey_2').AsString;
ul_alphaCode := myQuery.FieldByName('
somekey_3').AsString;
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
if metaFlag = True
then begin
root := xmlDoc.AddChild('
ImportData');
metaNode := root.AddChild('
MetaData');
metaNode.Attributes['
foo'] := AktSA;
{ and some more }
end;
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
SetLength(ad_exp_ekr_gd_groesse, myQuery.RecordCount);
for I := 0
to myQuery.RecordCount-1
do begin
{ add to xmlDoc }
myQuery.Next;
end;
{ItemPlanning}
ItemPlanning := item.AddChild('
somechild');
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
Form1.Memo1.Lines.Add(sLineBreak);
Form1.Memo1.Lines.Add(myQuery.SQL.Text);
Form1.Memo1.Lines.Add(IntToStr(myQuery.RecordCount) + '
Ergebnisse');
SetLength(country_category, myQuery.RecordCount);
for I := 0
to myQuery.RecordCount-1
do begin
{ add to xmlDoc }
myQuery.next;
end;
myQuery.First;
for C := 0
to high(country_category)
do begin
{ add to xmlDoc }
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
Form1.Memo1.Lines.Add(sLineBreak);
Form1.Memo1.Lines.Add(myQuery.SQL.Text);
Form1.Memo1.Lines.Add(IntToStr(myQuery.RecordCount) + '
Ergebnisse');
for I := 0
to myQuery.RecordCount-1
do begin
{ add to xmlDoc }
myQuery.Next;
end;
end;
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
AktPr := '
';
AktGr := '
';
for I := 0
to myQuery.RecordCount-1
do begin
{ add to xmlDoc }
myQuery.Next;
end;
{DoaAssignment}
{ItemI18N}
myQuery.SQL.Clear;
myQuery.SQL.Add('
...');
myQuery.Open;
for I := 0
to myQuery.RecordCount-1
do begin
{ add to xmlDoc }
myQuery.Next;
end;
if writeFlag = True
then begin
s1 := TStringList.Create;
s1.Assign(xmlDoc.XML);
s1.Insert(0, '
<?xml version="1.0" encoding="utf-8"?>');
s1.SaveToFile(fileName);
writeFlag = False;
metaFlag = True;
end;
end;
end;
end;
end.