1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| var
XMLDocumentOutput: TXMLDocument;
XMLStream: TStringStream;
begin
XMLDocumentOutput := TXMLDocument.Create(TComponent.Create(nil)); // Sans Owner, l'objet XML n'est pas stable avec son compteur de référence d'Interface IXMLNode*, FindNode plante inexplicablement sans Owner !
try
XMLStream := TStringStream.Create(UTF8Encode(OutputText)); // OutputText c'est la WideString provenant du WebService !
try
XMLStream.Seek(0, soFromBeginning);
XMLDocumentOutput.LoadFromStream(XMLStream);
if not XMLDocumentOutput.Active then
Abort;
finally
XMLStream.Free();
end;
XMLDocumentOutput est utilisable librement !
finally
XMLDocumentOutput.Owner.Free();
end;
end; |