<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23507"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013>Hi Chris,</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013>your only mistake is the use of the text
parser.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013>var features = txt.read(txtstr); //instead of
features.push(...)</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013>is the right way to get your
features.</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=784183315-20072013></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=784183315-20072013>you have also correct these parts</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>the txtstr should
have a header (you commented it)<BR>the body should have the same column length
as the header (your body have one column more)<BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=784183315-20072013><FONT color=#0000ff
size=2 face=Arial>and IE doesn't like commas after the last item of an object
list (your example doesn't work with IE8):</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>new
OpenLayers.Control.LayerSwitcher()</DIV></FONT><FONT color=#0000ff size=2
face=Arial></FONT>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial>################</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial> var txt =
new OpenLayers.Format.Text();</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial> var txtstr =
"lat\tlon\ttitle\tdescription\ticonSize\ticonOffset\ticon\n";</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial> for ( i=0; i
< spots.length ; i++)<BR> {<BR> var spot =
spots[i];<BR> var spot_name =
spot.getElementsByTagName("spot_name")[0].childNodes[0].nodeValue;<BR>
var gps_lat =
spot.getElementsByTagName("gps_lat")[0].childNodes[0].nodeValue;<BR>
var gps_long =
spot.getElementsByTagName("gps_long")[0].childNodes[0].nodeValue;<BR>
var spot_geopath =
spot.getElementsByTagName("spot_geopath")[0].childNodes[0].nodeValue;</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
//txtstr += gps_lat + "\t" + gps_long + "\t" + spot_name +
"\tDESC.TEST\t21,25\t21,25\t-10,-25\thttp://www.openlayers.org/dev/img/marker.png";<BR>
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";<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
console.log('DEBUG XML PARSER: \n' + txtstr);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
var features = txt.read(txtstr); //instead of features.push(...),
the text parser returns an array of
features<BR> console.log(features.length);<BR> return
features;</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
},<BR> CLASS_NAME:
"OpenLayers.Format.MyTestWebservice"</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial>################</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT size=2>if you
build the xml file by yourself, i suggest, that you change <wannadive-id>
to <wannadive>.<BR>Then you can get your spots as a collection of
elements<SPAN class=784183315-20072013>:</SPAN></FONT></FONT></FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>var searchResults
= this.getElementsByTagNameNS(data, "*", "search_result");<BR>var spots =
this.getElementsByTagNameNS(searchResults[0], "*", "wannadive");</FONT></DIV>
<DIV><SPAN class=784183315-20072013><FONT color=#0000ff size=2
face=Arial>...</FONT></SPAN></DIV>
<DIV><SPAN class=784183315-20072013><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>var
spot_id =
this.getElementsByTagNameNS(spots[i], "*",
"spot_id")[0].firstChild.nodeValue;</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=784183315-20072013><FONT color=#0000ff size=2
face=Arial>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=784183315-20072013><FONT color=#0000ff size=2
face=Arial>Arnd</FONT></SPAN><BR></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von
</B>Chris<BR><B>Gesendet:</B> Freitag, 19. Juli 2013 19:28<BR><B>An:</B>
OpenLayers ML<BR><B>Betreff:</B> Re: [OpenLayers-Users] Fwd: [Geoserver-users]
LayerSwitcher() notworking<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=gmail_quote>Hi,<BR>I have created a "live script" with my custom
format class; so it is possible to have access to the javascript: <A
href="http://www.naslain.com/tmp/gis/"
target=_blank>http://www.naslain.com/tmp/gis/</A> Using firebug, the XML and the
features array are visible.<BR>Untill now, my problem still occurs. No displayed
marks :-(<BR>Anyone?<BR>Best,<BR>Chris<BR></DIV></BODY></HTML>