5 Replies Latest reply on Jan 22, 2013 10:50 AM by jbowden

    Import XML with CDATA using ajax

    Ayar2045

      Hi, I know really little about programming but I think I've managed to find what my problem is. Please I need some help from you guys!

       

      I want to import data from a XML file and display that in a Text box. The data contained in the XML sections are articles written in HTML. As they could contain invalid XML characters they have added CDATA sections.

       

      This is the code I use in the compositionReady event:

       

      $.ajax({

        type:"GET",

        url:"data.xml",

        success: function(xml) {

       

         var content=$(xml).find('content').text();

       

          sym.$('TextBox').html(content);

       

         }

      });

       

      The problem is that the text displayed contains all of the HTML characters... however if I manually remove the <![CDATA[ and ]] from the XML file the text is correctly displayed. You can see a live version of the output at ayar.be, click on 'Welcome' and then 'How-to'.

       

      Any help or indication on how to solve this is greatly appreciated!