A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Using an HTML fragment from an XML CDATA block

  1. #1
    Retired SCORM Guru PAlexC's Avatar
    Join Date
    Nov 2000
    Location
    NJ
    Posts
    1,387

    Using an HTML fragment from an XML CDATA block

    So I'm using Spry to load an XML file into a Data Set. One of the fields in the data set is an HTML fragment, wrapped in CDATA tags.

    When I pull this fragment, and attempt to use it as an innerHTML attribute, I get text:

    e.g. when I set myDiv.innerHTML = spryData.getData()[0]["textnode"], instead of getting:

    Hello world!

    I get:

    <b>Hello</b> world!

    So what do I do to get my HTML back using javascript?
    "What really bugs me is that my mom had the audacity to call Flash Kit a bunch of 'inept jack-asses'." - sk8Krog
    ...and now I have tape all over my face.

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    Spry must be doing that conversion internally. Weird. I've never used Spry

    Try this: http://www.bram.us/2008/03/11/javasc...entity_decode/

  3. #3
    Retired SCORM Guru PAlexC's Avatar
    Join Date
    Nov 2000
    Location
    NJ
    Posts
    1,387
    Turns out there's a buried property in the Spry XML Data Set called entityEncodeStrings, which defaults to false. Turning it on solves everything. Thanks anyway.
    "What really bugs me is that my mom had the audacity to call Flash Kit a bunch of 'inept jack-asses'." - sk8Krog
    ...and now I have tape all over my face.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center