do not store redundant data in the object created by WFS Capabilities format, r=tschaub (closes #2640)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10348 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2010-05-20 20:05:52 +00:00
parent e4085bbdc6
commit 5f96b1f914
2 changed files with 7 additions and 10 deletions

View File

@@ -88,11 +88,10 @@ OpenLayers.Format.WFSCapabilities.v1 = OpenLayers.Class(
read_cap_Name: function(obj, node) {
var name = this.getChildValue(node);
if(name) {
obj.name = name;
var prefix = name.split(":")[0];
if(prefix !== name) {
obj.featurePrefix = prefix;
obj.featureNS = this.lookupNamespaceURI(node, prefix);
var parts = name.split(":");
obj.name = parts.pop();
if(parts.length > 0) {
obj.featureNS = this.lookupNamespaceURI(node, parts[0]);
}
}
},

View File

@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_read(t) {
t.plan(32);
t.plan(30);
var parser = new OpenLayers.Format.WFSCapabilities();
@@ -15,8 +15,7 @@
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");
t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct");
t.eq(ft[0]["name"], "tiger:poly_landmarks", "name of first feature type correct");
t.eq(ft[0]["featurePrefix"], "tiger", "prefix of first feature type correct");
t.eq(ft[0]["name"], "poly_landmarks", "name of first feature type correct");
t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct");
// GeoServer, v1.0.0
@@ -26,8 +25,7 @@
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");
t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct");
t.eq(ft[0]["name"], "tiger:poly_landmarks", "name of first feature type correct");
t.eq(ft[0]["featurePrefix"], "tiger", "prefix of first feature type correct");
t.eq(ft[0]["name"], "poly_landmarks", "name of first feature type correct");
t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct");
var service = res.service;