Hi, I'm using geoserver in back-end, and the problem was that when I made the getfeaureinfo request the returned response contained the '1' character (maybe is the number of matched results) so when I was parsing the gml I got no features and no errors. When I realized what the problema was, I could make it work with the following code:
data = data.substring(0,data.length-1); var theParser = new OpenLayers.Format.GML(); theParser.internalProjection = null; theParser.externalProjection = null; theParser.extractStyles = false; theParser.extractAttributes = true; var features = theParser.read(data); //Iterate through features ... Thanks. Un saludo, ·················································································· David Alda Fernández de Lezea Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad IKT Granja Modelo s/n · 01192 · Arkaute (Araba) ·················································································· Tlfnos.: 945-00-32-95 Fax: 945-00.32.90 ·················································································· email: [email protected] web: www.ikt.es ·················································································· -----Mensaje original----- De: Bino Oetomo [mailto:[email protected]] Enviado el: jueves, 07 de octubre de 2010 7:36 Para: David Alda Fernandez de Lezea Asunto: Re: [OpenLayers-Users] Problems parsing getfeatureinfo response from geoserver Hi David, Did you found the solution ? If so, Kindly please share it with me. Sincerely -bino- David Alda Fernandez de Lezea wrote: > Hi folks, > > I'm trying to parse a GML response from a getfeatureinfo request made to > geoserver but I can't retrieve the features from it. > > var theParser = new OpenLayers.Format.GML(); > theParser.internalProjection = null; theParser.externalProjection = > null; > theParser.extractStyles = false; > theParser.extractAttributes = true; > > var features = theParser.read(req.responseText); > > features.length is 0 > > XML attached to email. > > I've also tried the solution provided in > > http://www.mail-archive.com/[email protected]/msg16330.html > > Am I doing something wrong?? > > Thanks. > > Un saludo, > > ······································································ > ············ > > David Alda Fernández de Lezea > Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y > Biodiversidad > > IKT > Granja Modelo s/n · 01192 · Arkaute (Araba) > > ·················································································· > Tlfnos.: 945-00-32-95 Fax: 945-00.32.90 > ·················································································· > email: [email protected] web: www.ikt.es > ······································································ > ············ > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
