HTML tags in XML

Ken Ray kray at
Tue Mar 21 12:41:03 EST 2006

On 3/21/06 9:43 AM, "Devin Asay" <devin_asay at> wrote:

> Is it possible to store html styled text in an xml document and then
> successfully retrieve the text with html markup intact?

Yes. You need to use a CDATA node instead of a normal element node. The
markup looks like this:

  <![CDATA[<b>This is my markup</b>]]>

You can put anything into a CDATA node - it's ignored by the parser. My XML
Library handles getting and setting CDATA information for a node quite
easily - if your XML looked like this:

<?xml version="1.0"?>
  <myHTML><![CDATA[<b>This is my markup</b>]]></myHTML>

You could get the data with:

  put stsXML_GetNodeData("/root/myHTML") into tHTML

and set it with stsXML_SetNodeData.

By keeping it as CDATA you don't need to replace characters to get what you

Ken Ray
Sons of Thunder Software
Web site:
Email: kray at

More information about the Use-livecode mailing list