Solved

Parsing Xml With jQuery without Using XPath

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWK: digits < 10 add a zero how? 11 27
binding event to form in window.open 9 42
PowerShell logging 1 17
Fix Form size HTML 16 15
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…

820 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