Hi all,<br><br>I was working on that and facing the same problem, and I've just submitted a patch (see <a href="http://trac.openlayers.org/attachment/ticket/2819/2819.patch">http://trac.openlayers.org/attachment/ticket/2819/2819.patch</a>) that I think fixes that. It adds all the xmlns attributes that exist in the namespaces object of the format, but avoids doing so when, for example adding the xmlns attribute for "foo" namespace, the node itself of any of its attributes has the namespaceURI property set to this.namespaces["foo"].<br>
<br>I tested it in Firefox 3.6.8. I found that the behavior XMLSerializer.serializeToString(doc) lead to the addition of "xmlns:foo=bar" attributes for those nodes/attributes in the node that had nodeName="foo:name" and namespaceURI="bar".<br>
<br clear="all">Best regards,<br><br>Xurxo Méndez Pérez<br><br><div class="gmail_quote">2010/9/2 Bart van den Eijnden <span dir="ltr"><<a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hey Tim,<br>
<br>
right that solution would work for me.<br>
<br>
I've opened up:<br>
<a href="http://trac.openlayers.org/ticket/2819" target="_blank">http://trac.openlayers.org/ticket/2819</a><br>
<br>
Best regards,<br>
Bart<br>
<br>
--<br>
Looking for flexible support on OpenLayers or GeoExt? Please check out <a href="http://www.osgis.nl/support.html" target="_blank">http://www.osgis.nl/support.html</a><br>
<div class="im"><br>
Bart van den Eijnden<br>
OSGIS<br>
</div><a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a><br>
<div><div></div><div class="h5"><br>
On Sep 2, 2010, at 7:13 PM, Tim Schaub wrote:<br>
<br>
> On 9/2/10 3:31 AM, Bart van den Eijnden (OSGIS) wrote:<br>
>> Hi list,<br>
>><br>
>> I've been tracking down a problem in the SOS client, where the XML created<br>
>> had a value which is QName, i.e.:<br>
>><br>
>> <resultModel>om:Measurement</resultModel><br>
>><br>
>> However, even though "om" is in the namespaces object of the format,<br>
>> xmlns:om was not added automatically.<br>
>><br>
>> Is there a way to do this, similar to what is done for elements which are<br>
>> a QName, where things go okay automatically?<br>
>><br>
><br>
> The problem is that without a schema, there is no way for the parser to know the type of a text node. I don't have a good opinion of text nodes of type QName, and I wish they would just go away. But, assuming that is not going to happen, we could adopt a convention to manually add xmlns attributes for each namespace alias in the namespaces object. I think this is what other systems do (write an xmlns attribute at the root for every namespace that might possibly appear in the document).<br>
><br>
> If the base XML format wrote xmlns attributes in it's write method, other formats could get this for free if they call this method.<br>
><br>
> E.g. XML.js ~<br>
><br>
> write: function(node) {<br>
> for (var alias in this.namespaces) {<br>
> node.setAttribute("xmlns:" + alias, this.namespaces[alias]);<br>
> }<br>
> // ...<br>
><br>
> Would that do it for you?<br>
><br>
> Tim<br>
><br>
>> I now programmatically added the xmlns as a workaround.<br>
>><br>
>> Index: lib/OpenLayers/Format/SOSGetObservation.js<br>
>> ===================================================================<br>
>> --- lib/OpenLayers/Format/SOSGetObservation.js (revision 10712)<br>
>> +++ lib/OpenLayers/Format/SOSGetObservation.js (working copy)<br>
>> @@ -104,6 +104,7 @@<br>
>> */<br>
>> write: function(options) {<br>
>> var node = this.writeNode("sos:GetObservation", options);<br>
>> + node.setAttribute("xmlns:om", <a href="http://this.namespaces.om" target="_blank">this.namespaces.om</a>);<br>
>> this.setAttributeNS(<br>
>> node, this.namespaces.xsi,<br>
>> "xsi:schemaLocation", this.schemaLocation<br>
>><br>
>> Best regards,<br>
>> Bart<br>
>><br>
>> _______________________________________________<br>
>> Dev mailing list<br>
>> <a href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
><br>
><br>
> --<br>
> Tim Schaub<br>
> OpenGeo - <a href="http://opengeo.org" target="_blank">http://opengeo.org</a><br>
> Expert service straight from the developers.<br>
> _______________________________________________<br>
> Dev mailing list<br>
> <a href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
><br>
<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
</div></div></blockquote></div><br>