Solved

Parsing Xml With jQuery without Using XPath

Posted on 2007-11-19
3
3,509 Views
Last Modified: 2010-08-05
i need to upgrade to the latest jQuery version, and the Xpath extension did not work for me. I have not found any good new resources about code for parsing xml, the xml example is in the code window-

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?

<?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>

Open in new window

0
Comment
Question by:chrismarx
3 Comments
 

Accepted Solution

by:
chrismarx earned 0 total points
ID: 20349661
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20351827
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JavaScript export function not working in IE 15 38
Check if Object property exists? 3 19
Enter key on html form page 11 48
Objects on Same Line 2 18
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now