I have an xml file, which is pulled into a google map just fine.
I would like to add a directions option to my map.
In order to do this, I need a dropdown for all markers on the map.
开发者_运维技巧A row of my xml looks like
<marker id="12" name="placename" category="11" lat="66.555488"
lng="5.238545" address1="property name" address2="roadname"
address3="town" address4="" county="some county" postcode="ab1 1ab"/>
So in my html on the page, I need to show
<option value="53.2,5.238545">placename</option>
or
<option value="lat,lng">name</option>
repeated for each entry in the XML.
How can I generate such a dropdown automatically from the xml file?
Parse your XML using PHP (or another programming language). If you do it with PHP you can use the SimpleXML library.
You could also do it with Javascript. I'm not sure what Javascript library does xml.
精彩评论