Adding Web Map Context document parsing for versions 1.0.0 and 1.1.0. This also adds a cross browser setAttributeNS to the XML format. Thanks bartvde for supporting this work. r=crschmidt (closes #100)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@5919 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -348,6 +348,37 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
||||
}
|
||||
return found;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setAttributeNS
|
||||
* Adds a new attribute or changes the value of an attribute with the given
|
||||
* namespace and name.
|
||||
*
|
||||
* Parameters:
|
||||
* node - {Element} Element node on which to set the attribute.
|
||||
* uri - {String} Namespace URI for the attribute.
|
||||
* name - {String} Qualified name (prefix:localname) for the attribute.
|
||||
* value - {String} Attribute value.
|
||||
*/
|
||||
setAttributeNS: function(node, uri, name, value) {
|
||||
if(node.setAttributeNS) {
|
||||
node.setAttributeNS(uri, name, value);
|
||||
} else {
|
||||
if(this.xmldom) {
|
||||
if(uri) {
|
||||
var attribute = node.ownerDocument.createNode(
|
||||
2, name, uri
|
||||
);
|
||||
attribute.nodeValue = value;
|
||||
node.setAttributeNode(attribute);
|
||||
} else {
|
||||
node.setAttribute(name, value);
|
||||
}
|
||||
} else {
|
||||
throw "setAttributeNS not implemented";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.XML"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user