Solved

Parsing Xml With jQuery without Using XPath

Posted on 2007-11-19
3
3,508 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article will show, step by step, how to integrate R code into a R Sweave document
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

706 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

19 Experts available now in Live!

Get 1:1 Help Now