auto-configure featureType and featureNS. p=bartvde (closes #3367)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12110 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-06-20 10:59:28 +00:00
parent 18ad6643b6
commit 30fc6ecd52
7 changed files with 140 additions and 19 deletions

View File

@@ -140,7 +140,7 @@ OpenLayers.Format.WFST.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
}
var obj = {};
if(data) {
this.readNode(data, obj);
this.readNode(data, obj, true);
}
if(obj.features && options.output === "features") {
obj = obj.features;

View File

@@ -62,6 +62,29 @@ OpenLayers.Format.WFST.v1_0_0 = OpenLayers.Class(
OpenLayers.Format.WFST.v1.prototype.initialize.apply(this, [options]);
},
/**
* Method: readNode
* Shorthand for applying one of the named readers given the node
* namespace and local name. Readers take two args (node, obj) and
* generally extend or modify the second.
*
* Parameters:
* node - {DOMElement} The node to be read (required).
* obj - {Object} The object to be modified (optional).
* first - {Boolean} Should be set to true for the first node read. This
* is usually the readNode call in the read method. Without this being
* set, auto-configured properties will stick on subsequent reads.
*
* Returns:
* {Object} The input object, modified (or a new one if none was provided).
*/
readNode: function(node, obj, first) {
// Not the superclass, only the mixin classes inherit from
// Format.GML.v2. We need this because we don't want to get readNode
// from the superclass's superclass, which is OpenLayers.Format.XML.
return OpenLayers.Format.GML.v2.prototype.readNode.apply(this, [node, obj]);
},
/**
* Property: readers
* Contains public functions, grouped by namespace prefix, that will

View File

@@ -61,6 +61,29 @@ OpenLayers.Format.WFST.v1_1_0 = OpenLayers.Class(
OpenLayers.Format.WFST.v1.prototype.initialize.apply(this, [options]);
},
/**
* Method: readNode
* Shorthand for applying one of the named readers given the node
* namespace and local name. Readers take two args (node, obj) and
* generally extend or modify the second.
*
* Parameters:
* node - {DOMElement} The node to be read (required).
* obj - {Object} The object to be modified (optional).
* first - {Boolean} Should be set to true for the first node read. This
* is usually the readNode call in the read method. Without this being
* set, auto-configured properties will stick on subsequent reads.
*
* Returns:
* {Object} The input object, modified (or a new one if none was provided).
*/
readNode: function(node, obj, first) {
// Not the superclass, only the mixin classes inherit from
// Format.GML.v3. We need this because we don't want to get readNode
// from the superclass's superclass, which is OpenLayers.Format.XML.
return OpenLayers.Format.GML.v3.prototype.readNode.apply(this, [node, obj]);
},
/**
* Property: readers
* Contains public functions, grouped by namespace prefix, that will