Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get all attributes of a tag in an XML document using javascript?

Kris Noah
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have an xml file of the form:


I already have my program (mixture of JSP and javascript/ajax) able to retrieve all the latitude and longitude points from the XML file:

I've written other code using the Google Maps API to use these points to plot "polylines" onto the map. My question is how would I be able to only colour in, say, the points for bumper1 or bumper2? But not all. So when I call the GPolyline function for bumper1 or bumper2 etc, it will only plot the points for the intended tag. Currently it plots a Polyline for all the co-ordinates in a single colour.

I would need to store the lat/long points for these in some sort of an array and simply pass it to map.addOverlay(new GPolyline([b]pts,colour,width));[/b] is my understanding (Like: new GPolyline(some statement corresponding to all the points for bumper1, colour, width) ). Can someone please shed some light on this for me?

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic