Lazarus

Programming => General => Topic started by: krzynio on January 29, 2020, 11:39:23 am

Title: Copy content of TXMLDocument into TMemo
Post by: krzynio on January 29, 2020, 11:39:23 am
Hello!
To copy my XML document into memo I use such code
Code: Pascal  [Select][+][-]
  1.     st := TStringStream.Create('');
  2.     WriteXMLFile( Doc, st);
  3.     st.Position := 0;
  4.     memo.Lines.LoadFromStream(st);
  5.     st.Free
  6.  
but I fill that there must be more simple method like
Code: Pascal  [Select][+][-]
  1. memo.Lines.Text := XMLDoc.TextContents
  2.  
or something similar.
Can you help, please?
Title: Re: Copy content of TXMLDocument into TMemo
Post by: lucamar on January 29, 2020, 03:25:35 pm
AFAICT, there is no simpler way to do it. You could always add that code inside a class helper, if you use it in many places.

If you do, you should make it general enough that the XML can be loaded from/saved to any TStrings descendant.

HTH
Title: Re: Copy content of TXMLDocument into TMemo
Post by: krzynio on February 18, 2020, 02:48:18 pm
Thanx!
TinyPortal © 2005-2018