Correctly parse feature attributes when the attribute name matches the feature type name. r=bartvde (closes #2435)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10027 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-02-05 20:17:59 +00:00
parent 2d61186deb
commit db153e199a
2 changed files with 72 additions and 5 deletions

View File

@@ -331,12 +331,17 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
// geometry or attributes.
var name;
var local = node.localName || node.nodeName.split(":").pop();
if (!this.singleFeatureType &&
(OpenLayers.Util.indexOf(this.featureType, local) != -1)) {
// Since an attribute can have the same name as the feature type
// we only want to read the node as a feature if the parent
// node can have feature nodes as children. In this case, the
// obj.features property is set.
if (obj.features) {
if (!this.singleFeatureType &&
(OpenLayers.Util.indexOf(this.featureType, local) !== -1)) {
name = "_typeName";
}
else if(local == this.featureType) {
name = "_typeName";
} else if(local === this.featureType) {
name = "_typeName";
}
} else {
// Assume attribute elements have one child node and that the child
// is a text node. Otherwise assume it is a geometry node.