diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index 3ffa1b6a84..773009e158 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -269,6 +269,10 @@ "OpenLayers/Format/KML.js", "OpenLayers/Format/GeoRSS.js", "OpenLayers/Format/WFS.js", + "OpenLayers/Format/OWSCommon.js", + "OpenLayers/Format/OWSCommon/v1.js", + "OpenLayers/Format/OWSCommon/v1_0_0.js", + "OpenLayers/Format/OWSCommon/v1_1_0.js", "OpenLayers/Format/WFSCapabilities.js", "OpenLayers/Format/WFSCapabilities/v1.js", "OpenLayers/Format/WFSCapabilities/v1_0_0.js", @@ -287,10 +291,6 @@ "OpenLayers/Format/SLD.js", "OpenLayers/Format/SLD/v1.js", "OpenLayers/Format/SLD/v1_0_0.js", - "OpenLayers/Format/OWSCommon.js", - "OpenLayers/Format/OWSCommon/v1.js", - "OpenLayers/Format/OWSCommon/v1_0_0.js", - "OpenLayers/Format/OWSCommon/v1_1_0.js", "OpenLayers/Format/CSWGetDomain.js", "OpenLayers/Format/CSWGetDomain/v2_0_2.js", "OpenLayers/Format/CSWGetRecords.js", diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1.js b/lib/OpenLayers/Format/WFSCapabilities/v1.js index 1a5059bbf9..6d7bbd5aef 100644 --- a/lib/OpenLayers/Format/WFSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WFSCapabilities/v1.js @@ -15,7 +15,23 @@ * - */ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class( - OpenLayers.Format.WFSCapabilities, { + OpenLayers.Format.XML, { + + /** + * Property: namespaces + * {Object} Mapping of namespace aliases to namespace URIs. + */ + namespaces: { + wfs: "http://www.opengis.net/wfs", + xlink: "http://www.w3.org/1999/xlink", + xsi: "http://www.w3.org/2001/XMLSchema-instance", + ows: "http://www.opengis.net/ows" + }, + + /** + * Property: defaultPrefix + */ + defaultPrefix: "wfs", /** * Constructor: OpenLayers.Format.WFSCapabilities.v1_1 @@ -25,10 +41,6 @@ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class( * 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 @@ -44,83 +56,64 @@ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class( if(typeof data == "string") { data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); } + var raw = data; + if(data && data.nodeType == 9) { + data = data.documentElement; + } var capabilities = {}; - var root = data.documentElement; - this.runChildNodes(capabilities, root); + this.readNode(data, capabilities); return capabilities; }, - + /** - * Method: runChildNodes + * 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. */ - runChildNodes: function(obj, node) { - var children = node.childNodes; - var childNode, processor; - for(var i=0; i 0) { + obj.featureNS = this.lookupNamespaceURI(node, parts[0]); + } + } + }, + "Title": function(node, obj) { + var title = this.getChildValue(node); + if(title) { + obj.title = title; + } + }, + "Abstract": function(node, obj) { + var abst = this.getChildValue(node); + if(abst) { + obj["abstract"] = abst; } } } }, - - /** - * Method: read_cap_FeatureTypeList - */ - read_cap_FeatureTypeList: function(request, node) { - var featureTypeList = { - featureTypes: [] - }; - this.runChildNodes(featureTypeList, node); - request.featureTypeList = featureTypeList; - }, - - /** - * Method: read_cap_FeatureType - */ - read_cap_FeatureType: function(featureTypeList, node, parentLayer) { - var featureType = {}; - this.runChildNodes(featureType, node); - featureTypeList.featureTypes.push(featureType); - }, - - /** - * Method: read_cap_Name - */ - read_cap_Name: function(obj, node) { - 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]); - } - } - }, - /** - * Method: read_cap_Title - */ - read_cap_Title: function(obj, node) { - var title = this.getChildValue(node); - if(title) { - obj.title = title; - } - }, - - /** - * Method: read_cap_Abstract - */ - read_cap_Abstract: function(obj, node) { - var abst = this.getChildValue(node); - if(abst) { - obj["abstract"] = abst; - } - }, - CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1" }); diff --git a/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js b/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js index 8b86487b65..0dc41f67fb 100644 --- a/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js +++ b/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js @@ -25,136 +25,89 @@ OpenLayers.Format.WFSCapabilities.v1_0_0 = OpenLayers.Class( * options - {Object} An optional object whose properties will be set on * this instance. */ - - /** - * Method: read_cap_Service - */ - read_cap_Service: function(capabilities, node) { - var service = {}; - this.runChildNodes(service, node); - capabilities.service = service; - }, /** - * Method: read_cap_Fees + * 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. */ - read_cap_Fees: function(service, node) { - var fees = this.getChildValue(node); - if (fees && fees.toLowerCase() != "none") { - service.fees = fees; - } - }, - - /** - * Method: read_cap_AccessConstraints - */ - read_cap_AccessConstraints: function(service, node) { - var constraints = this.getChildValue(node); - if (constraints && constraints.toLowerCase() != "none") { - service.accessConstraints = constraints; - } - }, - - /** - * Method: read_cap_OnlineResource - */ - read_cap_OnlineResource: function(service, node) { - var onlineResource = this.getChildValue(node); - if (onlineResource && onlineResource.toLowerCase() != "none") { - service.onlineResource = onlineResource; - } - }, - - /** - * Method: read_cap_Keywords - */ - read_cap_Keywords: function(service, node) { - var keywords = this.getChildValue(node); - if (keywords && keywords.toLowerCase() != "none") { - service.keywords = keywords.split(', '); - } - }, - - /** - * Method: read_cap_Capability - */ - read_cap_Capability: function(capabilities, node) { - var capability = {}; - this.runChildNodes(capability, node); - capabilities.capability = capability; - }, - - /** - * Method: read_cap_Request - */ - read_cap_Request: function(obj, node) { - var request = {}; - this.runChildNodes(request, node); - obj.request = request; - }, - - /** - * Method: read_cap_GetFeature - */ - read_cap_GetFeature: function(request, node) { - var getfeature = { - href: {}, // DCPType - formats: [] // ResultFormat - }; - this.runChildNodes(getfeature, node); - request.getfeature = getfeature; - }, - - /** - * Method: read_cap_ResultFormat - */ - read_cap_ResultFormat: function(obj, node) { - var children = node.childNodes; - var childNode; - for(var i=0; iDS_giant_polygongiant_polygonurn:x-ogc:def:crs:EPSG:4326-180.0 -90.0180.0 90.0gml:Envelopegml:Pointgml:LineStringgml:PolygonLessThanGreaterThanLessThanEqualToGreaterThanEqualToEqualToNotEqualToLikeBetweenNullCheckabsabs_2abs_3abs_4acosAreaasinatanatan2betweenboundaryboundaryDimensionbufferbufferWithSegmentsCategorizeceilcentroidclassifyCollection_AverageCollection_BoundsCollection_CountCollection_MaxCollection_MedianCollection_MinCollection_SumCollection_UniqueConcatenatecontainsconvexHullcoscrossesdateFormatdateParsedifferencedimensiondisjointdistancedouble2boolendPointenvelopeEqualIntervalequalsExactequalsExactToleranceequalToexpexteriorRingfloorgeometryTypegeomFromWKTgeomLengthgetGeometryNgetXgetYgetZgreaterEqualThangreaterThanidIEEEremainderif_then_elsein10in2in3in4in5in6in7in8in9int2bboolint2ddoubleinteriorPointinteriorRingNintersectionintersectsisClosedisEmptyisLikeisNullisRingisSimpleisValidisWithinDistancelengthlessEqualThanlessThanlogmaxmax_2max_3max_4minmin_2min_3min_4notnotEqualTonumGeometriesnumInteriorRingnumPointsoverlapsparseBooleanparseDoubleparseIntpipointNpowPropertyExistsQuantilerandomrelaterelatePatternrintroundround_2roundDoublesinsqrtStandardDeviationstartPointstrConcatstrEndsWithstrEqualsIgnoreCasestrIndexOfstrLastIndexOfstrLengthstrMatchesstrReplacestrStartsWithstrSubstringstrSubstringStartstrToLowerCasestrToUpperCasestrTrimsymDifferencetantoDegreestoRadianstouchestoWKTunionUniqueIntervalwithin'; var res = parser.read(text); - t.eq(res.capability.request.getfeature.href.get, "http://localhost:80/geoserver/wfs?", "GetFeature GET endpoint correctly parsed"); - t.eq(res.capability.request.getfeature.href.post, "http://localhost:80/geoserver/wfs?", "GetFeature POST endpoint correctly parsed"); + t.eq(res.operationsMetadata["GetFeature"].dcp.http.get[0].url, "http://localhost:80/geoserver/wfs?", "GetFeature GET endpoint correctly parsed"); + t.eq(res.operationsMetadata["GetFeature"].dcp.http.post[0].url, "http://localhost:80/geoserver/wfs?", "GetFeature POST endpoint correctly parsed"); var ft = res.featureTypeList.featureTypes; t.eq(ft.length, 14, "number of feature types correct"); t.eq(ft[0]["abstract"], "Manhattan landmarks, identifies water, lakes, parks, interesting buildilngs", "abstract of first feature type correct");