Hello,

Just to let anyone know who has been following this thread, I have
fixed the problem, and it turns out to be completely unrelated to my
original 2 hypotheses. I had narrowed the problem down to this loop:

                for (var j = 0; j < sites.length; j++) {
                        InfoWinJeremy += sites[j].textContent + "\<br\>";
                }

My original hypothesis was that there was something wrong with the XML
Element parsing, but that turned out to be unrelated. The XML parsing
in this loop is absolutely fine. The issue is actually more related to
what Larry had suggested: "what is sites.length?". The problem is that
there were certain instances in which sites.length, a dynamic
variable, was zero. This is because there were no XML Element <site>
entries for some of my <Placemarks>. This was causing the loop to
increment from 0 to <0 (obviously not possible) and causing an error.
Javascript, in its infinite elegance was simply skipping the loop and
continuing on to the next valid statement. No error, no html generated
inside this infernal loop.

I simply ensured that there was at least one <sites> element for each
<Placemark> in the KML file and everything works totally fine. This is
sort of a logical error that most seasoned programmers would most
likely not make, but I am not a seasoned programmer (although I did
catch this one on my own!). Thanks to Larry and Mike, and I hope this
can help others in the future...

Jeremy

On May 13, 12:04 pm, JeremyF <[email protected]> wrote:
> Hi Larry,
>
> All good questions.... I thought of that as well;
>
> a) sites.length does exist and is visible (and correct) when I place a
> stop in firebug.
> b) I replaced the entire reference the XML file with a simple string,
> and still no luck.
>
> The only way I can get the HTML into the window is to comment out the
> loop:
>
>                 //loop through individual sites
>                 for (var j = 0; j < sites.length; j++) {
>                         InfoWin_html += "jeremy";
>                 }
>
> As you can see, I've replaced sites[j].firstChild.data + "\<br\>";
> with "jeremy" and it still does not work!
>
> Any suggestions?
>
> Thanks,
>
> Jeremy
>
> On May 13, 11:50 am, "[email protected]" <[email protected]>
> wrote:
>
> > On May 13, 11:20 am, JeremyF <[email protected]> wrote:
>
> > > Mike,
>
> > > You must have tried it when I was in the middle of debugging. I was
> > > testing a bunch of features. I'd have to leave it the way it is right
> > > now for you to try it. I will for a while if you'd like to test it in
> > > its current state, so you can see what's happening.
>
> > > The problem, as I've surmised, is not variable scope. I've narrowed it
> > > down to the loop
>
> > >                 for (var j = 0; j < sites.length; j++) {
> > >                         InfoWin_html += sites[j].firstChild.data + 
> > > "\<br\>";
>
> > Have you looked at doing browser independent xml parsing?
>
> > Does sites[j].firstChild.data exist?
> > What is sites.length?
>
> > Are you sure this exists?
> > markers[i].childNodes[7].childNodes[1].textContent;
>
> >   -- Larry
>
> > >                 }
>
> > > This is the problem area. I can't get anything to display that's
> > > generated inside this loop. If I cut the loop out, the HTML displays
> > > just fine.
>
> > > Thanks for your help...
>
> > > Jeremy
>
> > > On May 13, 10:48 am, Mike Williams <[email protected]> wrote:
>
> > > > Wasn't it JeremyF who wrote:
>
> > > > >Thanks for the response... I've seen some of your other responses and
> > > > >they are very poignant.You can't really notice the problem at first
> > > > >glance with this page. Perhaps I need to explain in further detail.
>
> > > > >The Info Windows should be containing more than just the "title" of the
> > > > >site. If you look at the kml file that I'm parsing, I've added a few
> > > > >extra tags for the left-most icon ONLY (Kearney Villa Rd.) to display.
>
> > > > YOur page never gets as far as displaying the Kearney Villa Rd marker.
> > > > It crashes on this line when processing Campo Road
> > > >   InfoWin_html += escape(sites[0].textContent) + "\<br\>";
> > > > because sites[0] is undefined.
>
> > > > --http://econym.org.uk/gmap
> > > > The Blackpool Community Church Javascript Team- Hide quoted text -
>
> > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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