Skip to content

Commit 52d69ec

Browse files
author
Bart van den Eijnden
committed
documentation is also an array, and lang is optional thanks @ahocevar for the catch
1 parent cbd9a90 commit 52d69ec

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/OpenLayers/Format/WFSDescribeFeatureType.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class(
156156
},
157157
"documentation": function(node, obj) {
158158
if (!obj.documentation) {
159-
obj.documentation = {};
159+
obj.documentation = [];
160160
}
161-
var lang = node.getAttribute("xml:lang");
162161
var value = this.getChildValue(node);
163-
obj.documentation[lang] = value.replace(this.regExes.trimSpace, "");
162+
obj.documentation.push({
163+
lang: node.getAttribute("xml:lang"),
164+
textContent: value.replace(this.regExes.trimSpace, "")
165+
});
164166
},
165167
"simpleType": function(node, obj) {
166168
this.readChildNodes(node, obj);

tests/Format/WFSDescribeFeatureType.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@
426426
var res = format.read(text);
427427
var property = res.featureTypes[0].properties[0];
428428
t.eq(property.annotation.appinfo[0], '{"title":{"en":"Population"}}', "appinfo read correctly");
429-
t.eq(property.annotation.documentation["en"], "Number of persons living in the state", "documentation read correctly");
429+
t.eq(property.annotation.documentation[0], {lang: "en", textContent: 'Number of persons living in the state'}, "documentation read correctly");
430430
}
431431

432432
</script>

0 commit comments

Comments
 (0)