views:

109

answers:

0

I have the following code the searchUrl gives xml output but i am not able to display output on map with markers. var searchUrl = "http://localhost:1894/blockseek8-9-2010/Block3.xml"; GDownloadUrl(searchUrl, function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName('marker'); map.clearOverlays();

            var sidebar = document.getElementById('sidebar');
            sidebar.innerHTML = '';
            alert(markers.length);

            if (markers.length == 0) {
                sidebar.innerHTML = 'No results found.';
                map.setCenter(new GLatLng(40, -100), 4);
                return;
            }

            var bounds = new GLatLngBounds();
            for (var i = 0; i < markers.length; i++) {
                var name = markers[i].getAttribute('name');
                var address = markers[i].getAttribute('address');
                var distance = parseFloat(markers[i].getAttribute('distance'));
                var point = new GLatLng(parseFloat(markers[i]
                .getAttribute('lat')), parseFloat(markers[i]
                .getAttribute('lng')));
                var imagepath = markers[i].getAttribute('imagepath');

                var marker = createMarker(point, name, address, imagepath);
                map.addOverlay(marker);
                var sidebarEntry = createSidebarEntry(marker, name, address,
                distance, imagepath);
                sidebar.appendChild(sidebarEntry);


                bounds.extend(point);
            }
            map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
        });
    }