Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Parsing Xml With jQuery without Using XPath

Posted on 2007-11-19
3
Medium Priority
?
3,518 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

722 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