procedure TForm4.Button1Click(Sender: TObject);
Const
Filename = '
c:\temp\testxml.xml';
var
FileStream :tfilestream;
//* Ausgabe der Aufgerufene Seite
i,j :Integer;
// * Zähler für die For-Schleife
DataStream :TIdMultiPartFormDataStream;
//* Übergabe Stream für Aufgerufene Seite
xpath :
string;
doc : IXMLDOMDocument;
//* XL DAtei
categories,
name : IXMLDOMNodeList;
//* enthält nodes
subNode : IXMLDOMNode;
//* enthält eine Node
begin
FileStream := TFileStream.create(Filename,fmCreate
or fmOpenWrite
or fmShareDenyWrite);
DataStream:=TIdMultiPartFormDataStream.Create;
IdHTTP1.Request.ContentType:='
multipart/form-data';
DataStream.addformfield('
user','
benutzer');
//Post-Daten in die StringList eintragen
DataStream.addformfield('
password','
password');
DataStream.addformfield('
action','
lese_kategorie');
idHTTP1.Post('
http://localhost\export\test.php',Datastream,FileStream);
//Datei abrufen
filestream.free;
doc := CoDOMDocument.Create;
doc.async:=false;
doc.load(filename);
xPath := '
/CATEGORIES/CATEGORIES_DATA/ID';
categories := doc.selectNodes(xpath);
for i := 0
to Pred(categories.length)
do
begin
xPath := format('
/CATEGORIES/CATEGORIES_DATA[%d]/ID',[i]);
subnode:= doc.selectsinglenode(xpath);
Memo1.Lines.add('
Kategorie: '+
string(subnode.Text)+'
gespeichert !');
xpath := Format('
/CATEGORIES/CATEGORIES_DATA[%d]/NAMES/NAMEENTRY',[i]);
name:= doc.selectNodes(xPath);
for j:= 0
to pred(
name.length)
do begin
xpath := Format('
/CATEGORIES/CATEGORIES_DATA[%d]/NAMES/NAMEENTRY[%d]/LANGUAGEID',[i,j]);
subnode := doc.selectsinglenode(xpath);
Memo1.lines.add('
Sprache : '+
string(subnode.text));
xpath := Format('
/CATEGORIES/CATEGORIES_DATA[%d]/NAMES/NAMEENTRY[%d]/NAME',[i,j]);
subnode := doc.selectsinglenode(xpath);
Memo1.lines.add('
Name : '+
string(subnode.text));
end;
//* for j
end;
//* for i
filestream.free;
end;