HTML tags in XML

Devin Asay devin_asay at byu.edu
Tue Mar 21 10:43:54 EST 2006


Hi Folks,

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

I'm working on an application where I need to save styled text in an  
XML document. I can successfully insert the htmlText of the styled  
field into the xml document so I end up with a node that looks like  
this:

<comments>
Here are my comments.
Some of the text is colored <font color="#FF0000">red</font> &  
<font color="#0000FF">blue</font>
</comments>

However, when I read this node in with the revXMLNodeContents()  
function the html tags are stripped out and all I get is naked text.  
Here's a code snippet:

     put revXMLNodeContents(vSessionTreeID,vCurrentComment) into  
tCommentTxt
     set the htmlText of fld "comments" of cd theCard of stack  
"ClipData" to tCommentTxt

When I examine the tCommentTxt variable in the variable watcher I see:

Here are my comments.
Some of the text is colored red & blue

Notice that it correctly rendered the ampersand entity. But the  
formatting is gone.

Is there a way to do this? Will I have to resort to saving the  
RTFtext in the xml node or something like that?

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list