修正WFS服务1.1.0版本的GetCapabilities信息解析问题
2011-07-13 12:20
127 查看
修正WFS服务1.1.0版本的GetCapabilities信息解析不完正的问题:
参考:http://trac.osgeo.org/openlayers/ticket/3285
参考:http://trac.osgeo.org/openlayers/ticket/3285
/** * @requires OpenLayers/Format/WFSCapabilities.js * @requires OpenLayers/Format/OWSCommon/v1_1_0.js */ /** * Class: OpenLayers.Format.WFSCapabilities/v1_1_0 * Read WFS Capabilities version 1.1.0. * * Inherits from: * - <OpenLayers.Format.WFSCapabilities> */ OpenLayers.Format.WFSCapabilities.v1_1_0 = OpenLayers.Class( OpenLayers.Format.OWSCommon.v1_1_0, { /** * Property: version * {String} The parser version ("1.1.0"). */ version: "1.1.0", /** * Property: namespaces * {Object} Mapping of namespace aliases to namespace URIs. */ namespaces: { ows: "http://www.opengis.net/ows", wfs: "http://www.opengis.net/wfs", xlink: "http://www.w3.org/1999/xlink" }, /** * Property: defaultPrefix * {String} The default namespace alias for creating element nodes. */ defaultPrefix: "wfs", /** * Constructor: OpenLayers.Format.WFSCapabilities.v1_1_0 * Create a new parser for WFS capabilities version 1.1.0. * * 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]); this.options = options; }, /** * APIMethod: read * Read capabilities data from a string, and return info about the WFS. * * Parameters: * data - {String} or {DOMElement} data to read/parse. * * Returns: * {Object} Information about the WFS service. */ read: function(data) { if(typeof data == "string") { data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); } if(data && data.nodeType == 9) { data = data.documentElement; } var capabilities = {}; this.readNode(data, capabilities); capabilities.version = this.version; return capabilities; }, /** * 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: { "wfs": { "WFS_Capabilities": function(node, obj) { this.readChildNodes(node, obj); }, "FeatureTypeList": function(node, obj) { obj.featureTypeList = {}; obj.featureTypeList.featureTypes = []; this.readChildNodes(node, obj.featureTypeList); }, "FeatureType": function(node, obj) { var featureType = { }; this.readChildNodes(node, featureType); obj.featureTypes.push(featureType); }, "Name": function(node, obj) { var name = this.getChildValue(node); if (name) { var parts = name.split(":"); obj.name = parts.pop(); if (parts.length > 0) { obj.featureNS = this.lookupNamespaceURI(node, parts[0]); } } }, "Title": function(node, obj) { obj.title = this.getChildValue(node); }, "FeatureNS": function(node, obj) { obj.featureNS = this.getChildValue(node); }, "DefaultSRS": function(node, obj) { var defaultSRS = this.getChildValue(node); if (defaultSRS) { obj.defaultSrs = defaultSRS; } }, "OutputFormats": function(node, obj) { obj.outputFormats = []; this.readChildNodes(node, obj.outputFormats); }, "Format": function(node, obj) { obj.push(this.getChildValue(node)); } }, "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"] }, CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0" });
相关文章推荐
- 关于Android 4.0以下版本解析带有bom头信息的json数据
- java excel解析:poi与jxl的区别(excel版本问题:xls,xlsx)
- Sql server 2005安装时 找不到 ASP.Net 在 Microsoft Internet 信息服务(IIS)中的版本注册信息。
- oracle版本用服务启动报错MybatisSystemException(java.math.bigDecimal cannot be cast to java.lang.Integer)问题
- spring 版本不同导致json解析问题,解决方案
- ubuntu 14.04 --系统的网络服务与此版本的网络管理器不兼容问题
- RC文件生成版本信息的问题
- web开发浏览器的问题,获取浏览器的版本信息
- 解决在CentOS6.5下安装OpenStack(Icehouse版本 )出现的glance服务无法正常工作的问题
- fabirc1.0商业正式版本源码解析12——peer的MSP服务
- 提示您必须安装带有更新版本windows installer服务的Windows Service Pack问题解决办
- java 中 poi解析Excel文件版本问题解决办法
- SVN使用:用TortoiseSVN查看Log 无法显示最新的版本和Log信息问题
- Arcgis server 发布wfs、wms服务注意的问题
- vs2012及以上版本中写c++时自动给代码添加创建信息注释的问题
- 关于Dalston.SR3版本的spring cloud,用feign客户端调用服务hystrix不能生效的问题
- Android Studio中打包之后版本异常问题解析
- 【bug记录】解决Eclipse中SVN版本信息不显示的问题