--- a/labs/openlayers/lib/OpenLayers/Format/WFSDescribeFeatureType.js +++ b/labs/openlayers/lib/OpenLayers/Format/WFSDescribeFeatureType.js @@ -1,1 +1,198 @@ +/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the Clear BSD license. + * See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ +/** + * @requires OpenLayers/Format/XML.js + * + * Class: OpenLayers.Format.WFSDescribeFeatureType + * Read WFS DescribeFeatureType response + * + * Inherits from: + * - + */ +OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class( + OpenLayers.Format.XML, { + + /** + * Property: namespaces + * {Object} Mapping of namespace aliases to namespace URIs. + */ + namespaces: { + xsd: "http://www.w3.org/2001/XMLSchema" + }, + + /** + * Constructor: OpenLayers.Format.WFSDescribeFeatureType + * Create a new parser for WFS DescribeFeatureType responses. + * + * Parameters: + * options - {Object} An optional object whose properties will be set on + * this instance. + */ + initialize: function(options) { + OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); + }, + + /** + * Property: readers + * Contains public functions, grouped by namespace prefix, that will + * be applied when a namespaced node is found matching the function + * name. The function will be applied in the scope of this parser + * with two arguments: the node being read and a context object passed + * from the parent. + */ + readers: { + "xsd": { + "schema": function(node, obj) { + var complexTypes = []; + var customTypes = {}; + var schema = { + complexTypes: complexTypes, + customTypes: customTypes + }; + + this.readChildNodes(node, schema); + + var attributes = node.attributes; + var attr, name; + for(var i=0, len=attributes.length; i