?
Solved

XML: creating IXMLNode with CData type

Posted on 2005-03-29
2
Medium Priority
?
3,190 Views
Last Modified: 2013-04-05
Hi all,
I've trouble in using TXMLDocument to create an XML file
such as below mentioned:
<header>
  <body>
   <![CDATA[This is my data]]>
  </body>
</header>,

For a note, I've use this kind of code
var
  bdy: IXMLNode;
begin
 Xmldocument.version:= '1.0';
 Xmldocument.encoding:= 'utf-8';
 Xmldocument.addchild('header');
 bdy:= xmldocument.documentelement.addchild('body');
 bdy.nodevalue:= 'This is my data';
end;

Someone can help me?

Thanks
Sirro
0
Comment
Question by:sirro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 400 total points
ID: 13653124
var
 hdr, bdy, dat: IXMLNode;
begin
 XMLDocument1.Active:= True;
 Xmldocument1.version:= '1.0';
 Xmldocument1.encoding:= 'utf-8';
 hdr:= Xmldocument1.addchild('header');
 bdy:= xmlDocument1.CreateNode('body', ntElement);
 hdr.ChildNodes.Add(bdy);
 dat:= xmlDocument1.CreateNode('This is my data', ntCDATA);
 bdy.ChildNodes.Add(dat);
 Memo1.Lines.Assign(XMLDocument1.XML);
end;
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 13654212
procedure TForm1.Button1Click(Sender: TObject);
var
  bdy: IXMLNode;
begin
Xmldocument1.Active:=True;
 Xmldocument1.version:= '1.0';
 Xmldocument1.encoding:= 'utf-8';
 Xmldocument1.addchild('header');
 bdy:= xmldocument1.documentelement.addchild('body');
 bdy.nodevalue:= '<![CDATA[This is my data]]>';

 Xmldocument1.SaveToFile('f:\test.xml');

end;
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question