From 52d69ecfda9e7a393e2dd909d42876b1c4a148d9 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Tue, 20 Nov 2012 16:48:50 +0100 Subject: [PATCH] documentation is also an array, and lang is optional thanks @ahocevar for the catch --- lib/OpenLayers/Format/WFSDescribeFeatureType.js | 8 +++++--- tests/Format/WFSDescribeFeatureType.html | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Format/WFSDescribeFeatureType.js b/lib/OpenLayers/Format/WFSDescribeFeatureType.js index dbd524f50e..9823aef232 100644 --- a/lib/OpenLayers/Format/WFSDescribeFeatureType.js +++ b/lib/OpenLayers/Format/WFSDescribeFeatureType.js @@ -156,11 +156,13 @@ OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class( }, "documentation": function(node, obj) { if (!obj.documentation) { - obj.documentation = {}; + obj.documentation = []; } - var lang = node.getAttribute("xml:lang"); var value = this.getChildValue(node); - obj.documentation[lang] = value.replace(this.regExes.trimSpace, ""); + obj.documentation.push({ + lang: node.getAttribute("xml:lang"), + textContent: value.replace(this.regExes.trimSpace, "") + }); }, "simpleType": function(node, obj) { this.readChildNodes(node, obj); diff --git a/tests/Format/WFSDescribeFeatureType.html b/tests/Format/WFSDescribeFeatureType.html index 3821c2dc1b..77f348d872 100644 --- a/tests/Format/WFSDescribeFeatureType.html +++ b/tests/Format/WFSDescribeFeatureType.html @@ -426,7 +426,7 @@ var res = format.read(text); var property = res.featureTypes[0].properties[0]; t.eq(property.annotation.appinfo[0], '{"title":{"en":"Population"}}', "appinfo read correctly"); - t.eq(property.annotation.documentation["en"], "Number of persons living in the state", "documentation read correctly"); + t.eq(property.annotation.documentation[0], {lang: "en", textContent: 'Number of persons living in the state'}, "documentation read correctly"); }