Hi Chris, your only mistake is the use of the text parser. var features = txt.read(txtstr); //instead of features.push(...) is the right way to get your features. you have also correct these parts the txtstr should have a header (you commented it) the body should have the same column length as the header (your body have one column more)
and IE doesn't like commas after the last item of an object list (your example doesn't work with IE8): new OpenLayers.Control.LayerSwitcher() ################ var txt = new OpenLayers.Format.Text(); var txtstr = "lat\tlon\ttitle\tdescription\ticonSize\ticonOffset\ticon\n"; for ( i=0; i < spots.length ; i++) { var spot = spots[i]; var spot_name = spot.getElementsByTagName("spot_name")[0].childNodes[0].nodeValue; var gps_lat = spot.getElementsByTagName("gps_lat")[0].childNodes[0].nodeValue; var gps_long = spot.getElementsByTagName("gps_long")[0].childNodes[0].nodeValue; var spot_geopath = spot.getElementsByTagName("spot_geopath")[0].childNodes[0].nodeValue; //txtstr += gps_lat + "\t" + gps_long + "\t" + spot_name + "\tDESC.TEST\t21,25\t21,25\t-10,-25\thttp://www.openlayers.org/dev/img/marke r.png"; txtstr += gps_lat + "\t" + gps_long + "\t" + spot_name + "\tDESC.TEST\t21,25\t-10,-25\thttp://www.openlayers.org/dev/img/marker.png\n "; } console.log('DEBUG XML PARSER: \n' + txtstr); var features = txt.read(txtstr); //instead of features.push(...), the text parser returns an array of features console.log(features.length); return features; }, CLASS_NAME: "OpenLayers.Format.MyTestWebservice" ################ if you build the xml file by yourself, i suggest, that you change <wannadive-id> to <wannadive>. Then you can get your spots as a collection of elements: var searchResults = this.getElementsByTagNameNS(data, "*", "search_result"); var spots = this.getElementsByTagNameNS(searchResults[0], "*", "wannadive"); ... var spot_id = this.getElementsByTagNameNS(spots[i], "*", "spot_id")[0].firstChild.nodeValue; Regards, Arnd _____ Von: openlayers-users-boun...@lists.osgeo.org [mailto:openlayers-users-boun...@lists.osgeo.org] Im Auftrag von Chris Gesendet: Freitag, 19. Juli 2013 19:28 An: OpenLayers ML Betreff: Re: [OpenLayers-Users] Fwd: [Geoserver-users] LayerSwitcher() notworking Hi, I have created a "live script" with my custom format class; so it is possible to have access to the javascript: http://www.naslain.com/tmp/gis/ Using firebug, the XML and the features array are visible. Untill now, my problem still occurs. No displayed marks :-( Anyone? Best, Chris
_______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users