1:sorry for this stupid question, but I am newbie in coding and this is something I am not able to even start with. I am trying to work with .kml and my teacher told me about using xpath.
This is the example of .kml from code.google:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Placemark>
<name>Simple placemark</name>
<description>Attached to the ground. Intelligently places itself
at the height of the underlying terrain.</description>
<Point>
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
</Point>
</Placemark>
</kml>
can you please give me a example of .html code returning (for example) the coordinates value ?
2: Do you think, X-path is really the best way, how to work with longer .kml files ? Or using jQuery, XQuery is better? or would you recommend something even easier?
Thanks a lot
Adam
HTML is a markup language like KML, and doesn’t have any parsing capabilities directly. You would have to load a JavaScript XPath library. There are some, but I thing that using jQuery is easier and provides more capability.
You can use jQuery.parseXML(): http://api.jquery.com/jQuery.parseXML/
You can also load the XML directly in JavaScript and do DOM processing. For instance:
http://www.hiteshagrawal.com/javascript/javascript-parsing-xml-in-javascript
DOM processing is more of a pain, jQuery is designed in part to avoid those problems.