diff --git a/lib/OpenLayers/Format/WFSDescribeFeatureType.js b/lib/OpenLayers/Format/WFSDescribeFeatureType.js index a946da060c..b71291e0f8 100644 --- a/lib/OpenLayers/Format/WFSDescribeFeatureType.js +++ b/lib/OpenLayers/Format/WFSDescribeFeatureType.js @@ -6,6 +6,7 @@ /** * @requires OpenLayers/Format/XML.js * @requires OpenLayers/Format/OGCExceptionReport.js + * @requires OpenLayers/Format/JSON.js */ /** @@ -17,6 +18,22 @@ */ OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class( OpenLayers.Format.XML, { + + /** + * Property: jsonFormat + * {OpenLayers.Format.JSON} + * Parser instance used to parse JSON for cross browser support. The native + * JSON.parse method will be used where available (all except IE<8). + */ + jsonFormat: null, + + /** + * Property: regExes + * Compiled regular expressions for manipulating strings. + */ + regExes: { + trimSpace: (/^\s*|\s*$/g) + }, /** * Property: namespaces @@ -52,15 +69,16 @@ OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class( complexTypes: complexTypes, customTypes: customTypes }; + var i, len; this.readChildNodes(node, schema); var attributes = node.attributes; var attr, name; - for(var i=0, len=attributes.length; i' + + '' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' {"title":{"en":"Population"}}' + + ' Number of persons living in the state' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ''; + var format = new OpenLayers.Format.WFSDescribeFeatureType(); + var res = format.read(text); + var property = res.featureTypes[0].properties[0]; + t.eq(property.annotation.appinfo.title["en"], "Population", "appinfo read correctly"); + t.eq(property.annotation.documentation["en"], "Number of persons living in the state", "documentation read correctly"); + } +