I'm trying to parse WFS reponse using OpenLayers.Format.GML parser. However, an exception thrown in my try-catch block is TypeError: a is undefined. Any pointers as to what I may be doing wrong will be appreciated.
protocol = new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: WFS_HOST,
featureType: "pl",
featureNS: "ws",
srsName: "EPSG:900913"
});
wfsLayer = new OpenLayers.Layer.Vector("PE Vector", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: protocol
});
var _Callback = function(resp) {
console.log(resp);
console.log(resp.error);
try {
var gmlParser = new OpenLayers.Format.GML();
gmlParser.extractAttributes = true;
var features = gmlParser.read(resp.responseText);
if(features){
for(var i = 0; i < features.length; i++) {
var feature = features[i];
// More operations
}
}
} catch(e) {
alert("Error: " + e);
}
};
response = protocol.read({
maxFeatures: 100,
callback: _Callback
});
My environment: GeoServer 2.1.3, OpenLayers 2.11, PostGIS 1.5.
