On Jan 26, 5:12 am, Mike Williams <[email protected]> wrote:
>
> Or you could write
>   <marker ...>
>     <category>ATV</category>
>     <category>Motorcycle</category>
>     <category>4x4</category>
>   </marker>
> and obtain the list of categories with
>   markers[i].getElementsByTagName("category")
> but that's more complicated, makes your XML file larger and doesn't give
> any advantages over the  categories="ATV,Motorcycle,4x4"  method.

It may make generation of the XML easier as you don't have to worry
about what happens to the last comma, and it's a better structure
because you shouldn't really have more than one piece of information
within an XML element or attribute.

I wrote this to Paul on 10 December when he contacted me directtly:

It's not generally good practice to combine data within a single XML
element in this way. It would be better to use
<marker>
 <category>ATV</category>
 <category>MC</category>
</marker>
because then you can retrieve all the category elements to loop
through them and extract the text (say as a variable called
"categorytext"). Within that loop you can then use something similar
to the Group post you found:
 marker.mycategory[categorytext]=true

You would then end up with markers with various elements of their
mycategory property as either true or undefined:
 marker.mycategory["ATV"]=true
 marker.mycategory["MC"]=true
and can use that property to decide whether or not to display the
marker.

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en.

Reply via email to