[Solved] Getting XML from response stream using Indy’s IDTCPClient [closed]


hmmmm, turns out it was easier than thought. I simply looked at the GenerateJSON method and said ok, How can I use this method for XML.

I then googled MempryStream to String and found this function

function StreamToString(aStream: TStream): string;
var
  SS: TStringStream;
begin
  if aStream <> nil then
  begin
    SS := TStringStream.Create('');
    try
      SS.CopyFrom(aStream, 0);  // No need to position at 0 nor provide size
      Result := SS.DataString;
    finally
      SS.Free;
    end;
  end else
  begin
    Result := '';
  end;
end;



Procedure TLtLiveConnector.GenerateXML;
begin
if ResponseStream <> nil then
  Begin
   ResponseXML_V := StreamToString(ResponseStream);
  End;
end;

solved Getting XML from response stream using Indy’s IDTCPClient [closed]