Actually, after looking more closely, I think libxml2 is innocent. <div><br></div><div>I was inserting features with requests that contained only the geometry - it seems I tried adding attributes to the insert around the same time as I was upgrading my system. What mislead me is that INSERT worked for a small subset of my layers (which have only one attribute) - so that had me barking up the wrong tree. </div>
<div>The matter remains that I can not INSERT except through some insufferable hanky-panky regarding column order on the database side - which for postgis and 13 layers is no picnic. The funny thing is that all of this is completely irrelevant when it comes to UPDATES.</div>
<div><br></div><div>Anyway - I must agree with you that an optional columns-order element would be nice approach in fixing this.</div>
<div><br></div><div>Kind regards, </div><div>Gissur<br>
<br><div class="gmail_quote">On Sat, Feb 19, 2011 at 2:26 PM, Jean-François Gigand <span dir="ltr"><<a href="mailto:jean-francois@gigand.fr" target="_blank">jean-francois@gigand.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Gissur,<br>
<br>
Interesting!<br>
I use libxml2 2.7.8 on Debian.<br>
<br>
I have spent quite some time check the WFS et XML schema specs.<br>
I was surprised but this is the normal behaviour.<br>
<br>
If you noticed a difference between two versions of libxml2, I would<br>
guess that the new version is right and the older was too tolerant for<br>
this sequence elements order issue.<br>
Maybe a clue could be find in the libxml2 change log...<br>
<br>
<br>
JF<br>
<br>
<br>
<br>
2011/2/19 Gissur Þórhallsson <<a href="mailto:gissur@loftmyndir.is" target="_blank">gissur@loftmyndir.is</a>>:<br>
<div><div></div><div>> I suddenly started getting this message too.<br>
> I'm not entirely sure what happened - I've had tinyOWS running without a<br>
> hitch for a couple of months now and then all of a sudden I start to get<br>
> "xml is not valid"<br>
> And peeping into the logs gives me:<br>
> [Sat Feb 19 12:42:34 2011] [ERROR] Element<br>
> '{<a href="http://my.namespaceurl.com/%7Darea" target="_blank">http://my.namespaceurl.com/}area</a>': This element is not expected. Expected<br>
> is one of ( {<a href="http://my.namespaceurl.com/%7Ddate_created" target="_blank">http://my.namespaceurl.com/}date_created</a>,<br>
> {<a href="http://my.namespaceurl.com/%7Ddate_modified" target="_blank">http://my.namespaceurl.com/}date_modified</a>,<br>
> {<a href="http://my.namespaceurl.com/%7Dusername" target="_blank">http://my.namespaceurl.com/}username</a>,<br>
> {<a href="http://geoserver.loftmyndir.is/%7Dorigin" target="_blank">http://geoserver.loftmyndir.is/}origin</a> ).<br>
><br>
> Funnily enough this does not happen to all layers - simple layers (as in<br>
> with few attributes, in my case only numeric area and a text field for<br>
> comments) seem unaffected.<br>
> I can't for the life of my figure out why this popped up all of sudden - the<br>
> only thing I can relate this to is a system-wide upgrade I made on my box,<br>
> which is running ubuntu 8.0.4. LTS box- and if I correlate my tinyows.logs<br>
> with /var/log/apt/term.log I see that the "Expected is one of [...]" only<br>
> start to appear around the time I upgraded libxml2 to libxml2<br>
> (2.6.31.dfsg-2ubuntu1.5) (I have no idea what version I was running before<br>
> that).<br>
> I'm going to see whether I can downgrade libxml2 and see if it changes<br>
> anything.<br>
> Or am I maybe barking up the completely wrong tree here?<br>
> Kind regards,<br>
> Gissur<br>
><br>
><br>
> On Mon, Jan 31, 2011 at 10:05 PM, Jean-François Gigand<br>
> <<a href="mailto:jean-francois@gigand.fr" target="_blank">jean-francois@gigand.fr</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> For an 1.0.0 insert request, I get the exception "xml isn't valid"<br>
>> with the following error:<br>
>> [Mon Jan 31 21:11:05 2011] [ERROR] Element '{<a href="http://domain.net/%7Dname" target="_blank">http://domain.net/}name</a>':<br>
>> This element is not expected. Expected is (<br>
>> {<a href="http://domain.net/%7Ddeleted" target="_blank">http://domain.net/}deleted</a> ).<br>
>><br>
>> "name" and "deleted" are (among others) valid feature attributes.<br>
>> If I change the attribute elements order in my test request XML file,<br>
>> and follow exactly the PostgreSQL column order for that table, it<br>
>> works.<br>
>><br>
>> I am surprised. The WFS spec doesn't require a proper feature<br>
>> attribute order in the list, does it?<br>
>><br>
>> Having checked the w3schools doc about XML Schema, the <xs:sequence><br>
>> element requires the element order to be respected.<br>
>> I see that validation is done by libxml2, and of course is done well.<br>
>><br>
>> The problem, within the use cases of TinyOWS, is that PostgreSQL does<br>
>> not provide any way to alter columns position.<br>
>><br>
>> You would say that the app should anyway fetch the feature schema by<br>
>> issuing a DescribeFeatureType request, and deal with the features<br>
>> according to it...<br>
>><br>
>> Actually, the OpenLayers serializer (exactly:<br>
>> OpenLayers.Format.GML.Base.prototype.writers.feature._typeName)<br>
>> creates the geometry first, then the attributes in object property<br>
>> (for .. in).<br>
>> If the geometry column in the PostgreSQL table is not the first (or<br>
>> second after identifier), I could never insert any feature, and a<br>
>> workaround with OpenLayers would be really messy.<br>
>><br>
>> This would be an issue of OpenLayers of course. But I think it<br>
>> wouldn't break the logic to add to the TinyOWS configuration an<br>
>> optional "columns-order" attribute on the <layer> elements.<br>
>> That attribute would contain the comma-separated list of columns to<br>
>> export to the WFS client in the order they should be listed in the<br>
>> DescribeFeatureType sequence.<br>
>><br>
>> It would also allow to restrict the columns to export.<br>
>><br>
>> What do you think?<br>
>><br>
>> --<br>
>> Jeff<br>
>> _______________________________________________<br>
>> TinyOWS-users mailing list<br>
>> <a href="mailto:TinyOWS-users@lists.maptools.org" target="_blank">TinyOWS-users@lists.maptools.org</a><br>
>> <a href="http://lists.maptools.org/mailman/listinfo/tinyows-users" target="_blank">http://lists.maptools.org/mailman/listinfo/tinyows-users</a><br>
><br>
><br>
><br>
> --<br>
> Gissur Þórhallsson<br>
><br>
> Loftmyndir ehf.<br>
> Laugavegur 13<br>
> IS 101 Reykjavík - Iceland<br>
> sími (tel): (+354) 540 2500<br>
> tölvupóstur (email): <a href="mailto:gissur@loftmyndir.is" target="_blank">gissur@loftmyndir.is</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Gissur Þórhallsson<br><br>Loftmyndir ehf.<br>Laugavegur 13<br>IS 101 Reykjavík - Iceland<br>sími (tel): (+354) 540 2500<br>tölvupóstur (email): <a href="mailto:gissur@loftmyndir.is" target="_blank">gissur@loftmyndir.is</a><br>
</div>