Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Parsing Xml With jQuery without Using XPath

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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 is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article discusses how to create an extensible mechanism for linked drop downs.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…
Suggested Courses

971 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