On Dec 18, 8:05 pm, mklausmeyer <[email protected]> wrote:
> Can someone help please?
> My xml file has rows like the following format.
>
> <marker Id="12" Address="1597 Morningstreet" City="Nowhere" State="AA"
> Zip="11000" />
>
> The code that I need to fix is the one below. I need to know how to
> concatinate the address.
>
> GDownloadUrl("./listings4.xml", function(data) {
> xml = GXml.parse(data);
> markers =
> xml.documentElement.getElementsByTagName("marker");
> for (var i = 0; i < markers.length; i++) {
> address = markers[i].getAttribute("Address");
> geocoder.getLocations(address, addToMap);}
>
> I know the code I tried below isn't correct. Can someone explain how
> to do this?
> Thank you so much in advance.
>
> address = markers[i].getAttribute("Address" + "City" + "State" +
> "Zip");
1. this is a general javascript question, nothing specific to the
google maps API.
2. String concatenation in javascript is done with the "+"
so your code:
address = markers[i].getAttribute("Address" + "City" + "State"
+"Zip");
is effectively doing:
address = markers[i].getAttribute("AddressCityStateZip");
Does your xml have an attribute "AddressCityStateZip"?
-- Larry
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.