That doesn't work for me. I get an error saying "length is null or not an object", because the $(path,xml) call did not return a result (I tried calling this outside of the for loop boundary to check this).
I've made the problem even simpler, maybe this will point to what I'm doing wrong. This code works (alerts an object): alert($("*")); and this code does not work (alerts an undefined) var xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<subscr.Subscriber>" + " <subscriberId>1</subscriberId>" + " <subscriberName>Default customer</subscriberName>" + "</subscr.Subscriber>"; alert($("*", xml)); Any idea why? Thanks! Jamie On Jan 5, 2:09 pm, chrismarx <[EMAIL PROTECTED]> wrote: > personally, i love using jquery thusly for parsing xml > > var xml = data; > var path = "subscr.Subscriber>subscriberId"; > > for (var i=0;i<$(path,xml).length;i++){ > alert( $(""+path+":eq("+i+")").text() ) > } > > On Jan 4, 3:09 pm, Jamie <[EMAIL PROTECTED]> wrote: > > > > > Hey, > > > I am attempting to process an XML document using jQuery but am hitting > > a brick wall. I've looked all over the web and it looks like this > > should be a very simple thing to do but I keep getting the error > > "Object does not support this property or method.". > > > I'm using jQuery 1.2.1 in IE6. I've switched to the unpacked version > > of jQuery and IE is reporting the error is happening on line 1363, > > which turns out to be the following line: > > > r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); > > > I've simplified my code as much as possible to eliminate as many > > complications as possible. The code I am executing is the following: > > > var xml = > > "<subscr.Subscriber>" + > > " <subscriberId>1</subscriberId>" + > > " <subscriberName>Default customer</subscriberName>" + > > "</subscr.Subscriber>"; > > > alert(xml); // Verify xml contents > > > var xmlData = jQuery(xml); > > alert(xmlData.length); // Not sure what the length should be, > > // but just checking the xmlData was > > created properly > > > var id = xmlData.find('subscriberId').text(); // Crashes here > > alert(id); // Should output '1' if it makes it here > > > I've also tried an alternate method of selecting my value, namely: > > > jQuery('subscriberId', xml).text(); > > > but this fails to at the same point. > > > Am I doing something wrong or missing something in my code? Has > > anyone else encountered this error message? > > > Thanks in advance, > > Jamie Goodfellow- Hide quoted text - > > - Show quoted text -