[OpenLayers-Dev] Format.XML, xmlns and QName

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Thu Sep 2 05:31:29 EDT 2010


Hi list,

I've been tracking down a problem in the SOS client, where the XML created
had a value which is QName, i.e.:

<resultModel>om:Measurement</resultModel>

However, even though "om" is in the namespaces object of the format,
xmlns:om was not added automatically.

Is there a way to do this, similar to what is done for elements which are
a QName, where things go okay automatically?

I now programmatically added the xmlns as a workaround.

Index: lib/OpenLayers/Format/SOSGetObservation.js
===================================================================
--- lib/OpenLayers/Format/SOSGetObservation.js  (revision 10712)
+++ lib/OpenLayers/Format/SOSGetObservation.js  (working copy)
@@ -104,6 +104,7 @@
      */
     write: function(options) {
         var node = this.writeNode("sos:GetObservation", options);
+        node.setAttribute("xmlns:om", this.namespaces.om);
         this.setAttributeNS(
             node, this.namespaces.xsi,
             "xsi:schemaLocation", this.schemaLocation

Best regards,
Bart



More information about the Dev mailing list