Solved

Parsing Xml With jQuery without Using XPath

Posted on 2007-11-19
3
3,516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

628 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