Recent

Author Topic: XML Send as string  (Read 732 times)

michoux

  • Full Member
  • ***
  • Posts: 112
XML Send as string
« on: January 27, 2021, 01:26:55 pm »
Hello,

During my application I am creating a XML document.
Doc: TXMLDocument;
 
When I finish with creation I would like to send the content of this document over network with tblocksocket.
At the moment I use writeXMLFile(Doc, 'c:\....');
connection:TBlockSocket;
 connection.SendString(message+CR+LF);

But now I would like to send this xml feed to some server ...  and I would like to read response of the connection.SendString.


Regards Michoux


paweld

  • Hero Member
  • *****
  • Posts: 970
Re: XML Send as string
« Reply #1 on: January 27, 2021, 02:13:19 pm »
Code: Pascal  [Select][+][-]
  1. var
  2.   doc: TXMLDocument;
  3.   xmls: TStringStream;
  4. begin
  5.   //create xml
  6.   xmls := TStringStream.Create('');
  7.   writeXML(Doc, xmls);               //save to string stream
  8.   Doc.Free;
  9.   connection.SendString(xmls.DataString + CRLF);
  10.   xmls.Free;
  11. end;        
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018