HTML tags in XML
Ken Ray
kray at sonsothunder.com
Tue Mar 21 12:41:03 EST 2006
On 3/21/06 9:43 AM, "Devin Asay" <devin_asay at byu.edu> 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"?>
<root>
<myHTML><![CDATA[<b>This is my markup</b>]]></myHTML>
</root>
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
want...
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list