[jQuery] Re: Traverse XML string
var xml = foodburgercheese/burger/food; var result = $(xml).find(food).find(burger).text(); The root node for your xml is food, so when you try to find a nested food node in that it fails. Try $(xml).find(burger).text();
[jQuery] Re: Traverse XML string
I tried that but still get an empty result. I seached google and saw examples like yours all over the place so maybe it's something else. here's the full source: html head title/title script type=text/javascript language=javascript src=jquery-1.2.6.min.js/script script type=text/javascript language=javascript $(document).ready(function() { $(body).css(background-color, yellow); var xml = foodburgercheese/burger/food; var result = $(xml).find(burger).text(); alert(result); }); /script /head /html On Dec 7, 5:44 pm, Dave Methvin [EMAIL PROTECTED] wrote: var xml = foodburgercheese/burger/food; var result = $(xml).find(food).find(burger).text(); The root node for your xml is food, so when you try to find a nested food node in that it fails. Try $(xml).find(burger).text();
[jQuery] Re: Traverse XML string
Your example works for me. Use firebug and make sure you are not getting errors from some other problem.
[jQuery] Re: Traverse XML string
Hi Dave, I thought jquery is browser-independent but it seems the code works for firefox but not for IE, any idea why? On Dec 7, 8:00 pm, Dave Methvin [EMAIL PROTECTED] wrote: Your example works for me. Use firebug and make sure you are not getting errors from some other problem.
[jQuery] Re: Traverse XML string
Yeah, I see what you mean about IE now. The problem seems to be that IE can't tell whether the string is HTML or XML, and jQuery doesn't have a way to tell either. Mike Geary posted a parser that works for both that you can use to parse the string and pass that tree into jQuery. http://groups.google.com/group/jquery-en/browse_frm/thread/95718c9aab2c7483/af37adcb54b816c3?lnk=gstq=parsexml#af37adcb54b816c3