John,
Thank you for looking at this. Removing the '//' helps a little. Now
both the alerts work in FF, and in IE6 it no longer throws an error, but
both of the searches in IE6 appear to return a null string (ie: '')
Also changing the first alert to:
alert("'" +
$('/html/body/xml/[EMAIL PROTECTED]"country"]/[EMAIL PROTECTED]"NAME"]').text()
+ "'");
works on FF but throws an error on IE6. This might be a clue about what
is going on.
-Steve
John Resig wrote:
> Stephen -
>
> After doing some testing, it seems as if the culprit is the '//' that
> you have in front of your expression. It's perfectly ok to remove it -
> as it will continue to work correctly.
>
> It seems to be that if you do .find("//foo") or $("//foo", context) it
> freaks out. But this is ok, since doing that is completely redundant
> in jQuery. Just remove the // to make it .find("foo") or $("foo",
> context) and you'll be fine.
>
> I'm still not entirely sure /why/ this happens - but it does. Here's
> the ticket for it:
> http://jquery.com/dev/bugs/bug/281/
>
> Does changing this fix the problems that you were having related to bug #164?
>
> --John
>
> On 10/14/06, Stephen Woodbridge <[EMAIL PROTECTED]> wrote:
>> Hi all,
>>
>> I am trying to figure out xpath queries, but I am missing something
>> and/or running into bugs. John pointed me at Bug #164, which has been
>> closed, but I still have problems. Here is a simple script with two
>> alerts. Each alert should report "United States" from the embedded xml.
>>
>> o The 1st alert works on on FF but not IE6
>> o The 2nd alert does not work on either
>>
>> Are these bugs?
>> Do I need to open a bug on these?
>> Am I doing this wrong?
>>
>> Thanks,
>> -Steve
>>
>> Here is a url to test it:
>> http://imaptools.com:8081/maps/test2.html
>>
>> Here is source:
>> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
>> <head>
>> <script type="text/javascript" src="/js/jquery.js"></script>
>> <script type="text/javascript">
>>
>> $(document).ready(function(){
>>
>> // get the xml data island
>> var xml = $("#aaa");
>>
>> // this searches the dom and works in FF but not IE 6
>> alert( $('//[EMAIL PROTECTED]"country"]/[EMAIL PROTECTED]"NAME"]'
>> ).text());
>>
>> // this should search using the xml variable as context
>> // this does not work in either FF or IE6
>> alert( $('//[EMAIL PROTECTED]"country"]/[EMAIL PROTECTED]"NAME"]',
>> xml ).text());
>>
>> });
>> </script>
>>
>> </head>
>> <body>
>>
>> <xml id="aaa" style="display: none;">
>> <point srsName="geographic">
>> <coordinates>
>> -71.385697,42.636016
>> </coordinates>
>> </point>
>> <feature typeName="country">
>> <description>
>> Country
>> </description>
>> <property typeName="NAME">
>> United States
>> </property>
>> <property typeName="CAPITAL">
>> Washington DC
>> </property>
>> <property typeName="CONTINENT">
>> North America
>> </property>
>> <property typeName="DISTANCE_TO_POINT" typeUnits="feet">
>> 0
>> </property>
>> </feature>
>> </xml>
>>
>> </body>
>> </html>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
>
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/