Thanks for your answer I think i was not clear, I used to be a XML/XSL developper so i wanted to access this specific tag. After browsing the different examples and mainly the GMLparser example, i found some answers. I can obtain using OL code the bouding box of my polygon directly.
This is a my current code: g = new OpenLayers.Format.GML(); features = g.read(req.responseText); var bounds = features[1].geometry.getBounds(); It works fine with the XMLs available for this OL example but with my GML, i always have features.length=0. By doing Alert(req.responseText), i obtain effectively my GML but no features are considered in it. In attachment, you will find my GML: http://www.nabble.com/file/p13750828/gml.xml gml.xml . I really hope you can help me. Thanks Sylvain Christopher Schmidt-4 wrote: > > On Wed, Nov 14, 2007 at 07:17:08AM -0800, springrider wrote: >> >> Good morning >> >> I would be interested to extract/read text within some tags >> (wfs:FeatureCollection\gml:boundedBy\gml:Box\gml:coordinates) from my >> GML. I >> am now struggling trying to write the correct syntax. I tried something >> like >> that: >> var myGml= new >> OpenLayers.Layer.GML("myGML","http://193.43.36.238:8282/geoserver/wfs?request=GetFeature&typename=fifao:Fao_areas&cql_filter=F_AREA=27"); >> var myExtent= >> myGml.read("wfs:FeatureCollection\gml:boundedBy\gml:Box\gml:coordinates") >> >> But it is not correct.Could you please help me? I would then use this >> text >> to define the extent of my map. > > This isn't going to do what you want it to do. > > 1. None of the OpenLayers libraries include support for xpath like > navigation of XML documents. > 2. The GML parser returns features; additional metadata from the > document is ignored. > 3. The Layer is just about displaying data; you're more likely to want > to use the Format (but it still won't do what you want.) > > You'll probably want to use the Format.XML class to load the data, and > use standard DOM methods to manipulate the loaded XML, or the Format.XML > specific getElementsByTagNameNS and the like. > > OpenLayers is a map library, rather than a geodata management framework, > so it doesn't provide the tools to do what you want easily, as far as > I'm aware. > > Regards, > -- > Christopher Schmidt > MetaCarta > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > > -- View this message in context: http://www.nabble.com/Extract-read-attributes-from-GML-tf4805707.html#a13750828 Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
