[jQuery] replace XPath functions for XML parsing
I'd like to keep up with the new jquery release and abandon my xpath
code for parsing xml, but I haven't seen anything that will do what i
need. Here's an example of what i did with xpath:
//xml
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<Folder>
<name>Final_Label_geom</name>
<open>1</open>
<Placemark>
<Style>
<IconStyle>
<color>ffc0c0c0</color>
</IconStyle>
</Style>
<Point>
<extrude>1</extrude>
<coordinates>-77.988788,30.779793,0.000000 </coordinates>
</Point>
</Placemark>
<Placemark>
<Style>
<LineStyle>
<color>ff000000</color>
<width>1</width>
</LineStyle>
</Style>
<LineString>
<tessellate>1</tessellate>
<extrude>1</extrude>
<coordinates>-96.621063,33.166782,0.000000
-101.993915,34.013136,0.000000 </coordinates>
</LineString>
</Placemark>
as you can see, each placemark can contain different types of tags, so
i need to just be able to access the coordinates by giving different
paths like:
for (var j=0; j<placemarks.length/3; j++) {
var coords = $('Document/Folder:eq('+1+')/Placemark:eq('+j+')/
LineString/coordinates', xml).text();
etc...
is there any good way to do this?