Hi Michael,
*Thanks for your useful hints.I correct the missing parts however I am not
getting the poly-lines yet!*
*The other thing,I can see the markers when i am running the code on apache
but I am not getting them on my blog! *
*
*
On Tue, Nov 23, 2010 at 2:21 PM, Michael Geary <[email protected]> wrote:

> When your code reaches this statement:
>
>             var colour = lines[a].getAttribute("colour");
>
> what is the value of the variable named "a"? Do you *have* a variable named
> "a"?
>
> Do you see how this relates to xelawho's question about how you changed the
> "for" loop?
>
> Also, don't you have any debugging tools such as Firebug? Those would be a
> tremendous help for diagnosing problems like this.
>
> One last thing: I do not recommend putting the opening curly brace on its
> own line in JavaScript. Put it at the end of the "for" or "if" or other
> statement that it belongs to:
>
>     if( foo ) {
>         bar();
>     }
>
> Not:
>
>     if( foo )
>     {
>         bar();
>     }
>
> In many cases it will work OK either way, but there's a quirk in JavaScript
> (semicolon insertion) that leads to some situations where the brace on its
> own line will not work as you expect. So don't do it unless you like
> surprises. :-)
>
> -Mike
>
> On Tue, Nov 23, 2010 at 1:38 PM, Behrouz Hosseini <[email protected]
> > wrote:
>
>> Dear xelawho,
>> *I think I already mentioned that I tried to modified the Mike's code so
>> this the way that i tried to create a function like below*
>> *
>>
>> function addLines()
>> {
>>  GDownloadUrl("http://geoca.persiangig.com/line.xml";, function(point, 
>> responseCode)
>>   {
>>    var xml = GXml.parse(point);
>>    var lines = xmlDoc.documentElement.getElementsByTagName("line");
>>
>>           // read each line
>>           for (var i = 0; i < lines.length; i++)
>>                {
>>             // get any line attributes
>>             var colour = lines[a].getAttribute("colour");
>>             var width  = parseFloat(lines[a].getAttribute("width"));
>>             // read each point on that line
>>             var points = lines[a].getElementsByTagName("tpoint");
>>             var pts = [];
>>
>>             for (var i = 0; i < points.length; i++) {
>>                pts[i] = new GPoint(parseFloat(points[i].getAttribute("lat")),
>>                                    
>> parseFloat(points[i].getAttribute("lng")));
>>             }
>>             gmap.addOverlay(new GPolyline(pts,colour,width));
>>           }
>> });
>> }
>>
>> *I can connect to my XML file and read the point data for 3 markers but
>> not for polylines!
>> I really did not understand what you mean by"asking the odd question
>> here" but do you really think this is Odd question?
>>
>> On Tue, Nov 23, 2010 at 1:02 PM, xelawho <[email protected]> wrote:
>>
>>> Hi Behseini,
>>>
>>> I can tell you from experience that you can put a map together without
>>> knowing too much about javascript, just by copying and pasting other
>>> people's code and asking the odd question here, but you have to be
>>> very careful about what you copy and what you change if you don't
>>> understand what it does.
>>>
>>> Have a look at Mike's original code:
>>> // read each line
>>>          for (var a = 0; a < lines.length; a++) {
>>>            // get any line attributes
>>>            var colour = lines[a].getAttribute("colour");
>>>
>>> and yours:
>>> // read each line
>>>          for (var i = 0; i < lines.length; i++)
>>>                  {
>>>            // get any line attributes
>>>            var colour = lines[a].getAttribute("colour");
>>>
>>> see the difference?
>>> also, I doubt that:
>>> var points = lines[a].getElementsByTagName("tpoint");
>>>
>>> is going to fly, but I may be wrong...
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google Maps API V2" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<google-maps-api%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-maps-api?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google Maps API V2" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-maps-api%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-maps-api?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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