logo       

XPath query whoas/bugs?: msg#01241

lang.javascript.jquery

Subject: XPath query whoas/bugs?

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( $('//feature[@typeName="country"]/property[@typeName="NAME"]'
).text());

// this should search using the xml variable as context
// this does not work in either FF or IE6
alert( $('//feature[@typeName="country"]/property[@typeName="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>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise