Ticket #1166 (closed bug: wontfix)
OpenLayers.Format.GML does not correctly extract GML3 Feature ID
| Reported by: | openlayers | Owned by: | tschaub |
|---|---|---|---|
| Priority: | blocker | Milestone: | |
| Component: | Format.GML | Version: | 2.5 |
| Keywords: | WFS 1.1.0 GML GML3 | Cc: | |
| State: |
Description
I've been working with WFS 1.1.0 lately and noticed that the Feature ID is not being extracted correctly for GML3 data by OpenLayers.Format.GML.
The current code is
fid = childNode.getAttribute("fid")
childNode.getAttribute("id");
I assume that the latter call is for GML3. In GML3, however, the id attribute must be namespace qualified. I suppose it may work if http://www.opengis.net/gml is the default namespace. Since IE doesn't support getAttributeNS, I fixed my local copy like this:
fid = childNode.getAttribute("fid")
childNode.getAttribute("id");
if (!fid) {
for (var index = 0; index < childNode.attributes.length; index++) {
var length = childNode.attributes[index].nodeName.length;
if ((length > 3) && (childNode.attributes[index].nodeName.substring(length-3) == ":id")) {
fid = childNode.attributes[index].nodeValue;
break;
}
}
}
It works in FF2/IE7 for WFS 1.0.0/1.1.0.

