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]
[+]
[-]
st
:
=
TStringStream
.
Create
(
''
)
;
WriteXMLFile
(
Doc
,
st
)
;
st
.
Position
:
=
0
;
memo
.
Lines
.
LoadFromStream
(
st
)
;
st
.
Free
but I fill that there must be more simple method like
Code: Pascal
[Select]
[+]
[-]
memo
.
Lines
.
Text
:
=
XMLDoc
.
TextContents
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