The issue here is that there is no text in the <html> node.  The '<'
and '>' are reserved in XML, they create nodes in XML.  I haven't
tried this, but you might want to try grabbing the .html() of the
<html> node.  If you really want to gab the text you'd have to move
all the way down to the td node and grab that using $('td',
xml).text().

On Sep 26, 12:34 pm, russellneufeld <[EMAIL PROTECTED]> wrote:
> Apologies if this has been asked before.  I couldn't find any topics
> on this when I searched.
>
> I have some XML which looks like the following:
>
> <?xml version="1.0"?>
> <response>
>     <status>1</status>
>     <html><![CDATA[
>         <tr>
>             <td>Row 1, Column 1</td>
>             <td>Row 1, Column 2</td>
>         </tr>
>         <tr>
>             <td>Row 2, Column 1</td>
>             <td>Row 2, Column 2</td>
>         </tr>
>     ]]></html>
> </response>
>
> I'd like to be able to read the html in javascript with something like
> this:
>
>         $.post("test.xml",
>                function(xml)
>                {
>                    new_html = $("html", xml).text();
>                    // Do something with the new html....
>                });
>
> However if the XML element is using CDATA,  $("html", xml).text()
> always returns the empty string.  Is this a known issue?  Is this a
> limitation of jQuery?  Is there a workaround?
>
> Thanks,
>
>   Russ

Reply via email to