Skip to main content
Participating Frequently
November 13, 2007
Question

HTML in an XML node

  • November 13, 2007
  • 4 replies
  • 306 views
I know I'm missing something basic here. If I have a simple XML document and it contains html that will be displayed in a html textfield (see code snippet) how do you get around the fact that the a tag is seen as a node? So if I'm using something like firstChild.childNodes[0].nodeValue - how can I get this to include the html tag? Do I have to indicate that the node is something other than text, is there such a things as a html node? Or do I have to excape somehow? Thanks.
This topic has been closed for replies.

4 replies

smcaulifAuthor
Participating Frequently
November 13, 2007
thanks to all - good to go!
Inspiring
November 13, 2007
Make sure the field is set to be html formatted (field.html = true) and use field.htmlText = "" instead of field.text = ""

Then use CDATA in your xml:
<mynode><![CDATA[click <a href='#'>here</a>]]></mynode>

That should do it
Inspiring
November 13, 2007
This is probably a better example.

http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid=1289479&highlight_key=y&keyword1=CDATA

I showed another way to do it there, but CDATA is the better way.
Inspiring
November 13, 2007
You should use a CDATA node if you want to include html

Read through this and post again if you have more questions/don't understand it.

http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid=1308394&highlight_key=y&keyword1=CDATA