How do you see all elements in xml?
I have a php page that spits out xml. If I call the page directly I get xml that looks like this:
-
<?xml version="1.0" standalone="yes" ?>
<data>
<id>21</id>
<nbr_rank>1</nbr_rank>
<new_total>1</new_total>
</data>
I also have the php script write to the error_log the same thing that it sends to the brower, and I am seeing the same thing:
-
<?xml version="1.0" standalone="yes"?>\n\t<data>\n\t\t<id>21</id>\n\t\t<nbr_rank>1</nbr_rank>\n\t\t<new_total>1</new_total>\n\t</data>
However, if I try to access the <new_total> value with jQuery:
-
alert("New total: |" + $("new_total", xml).text() + "|");
I don't get any data:
-
New total: ||
If I try to loop through the elements like this:
-
$(xml).find("data").each(function (){
alert($(this).text());
});
I do get the values (only one alert):
-
21
1
If I replace "data" above with either "id" or "nbr_rank" the alert spits out 21 and 1 respectively. However, if I put "new_total" in there, no alert is displayed.
So the bottom line is that I probably have something wrong with my XML, but I'm not sure how to get a dump of the actual structure from jQuery.