[Inteproxy-devel] inteproxy now requires lxml

Bernhard Herzog bh at intevation.de
Wed Feb 7 20:05:18 CET 2007


Hi,

The fix for issue #260 (POST requests for OWSProxy) required an XML parsers 
that would report namespaces with the prefixes used in the XML document.  
Unfortunately, the parsers that come with the python standard library cannot 
do this, so a third-party module had to be used.  The one I used is lxml[1] 
which is a python binding to libxml and libxslt.

Some background on why this is necessary:
When the client uses the POST method to send requests to the OWSProxy the 
username and password have to be added as attributes to the XML structure in 
the body of the http request.  To do that properly the InteProxy has to parse 
the XML, insert the new attributes and write out the XML again.  The 
namespaces have to be preserved while doing this.  In particular all 
namespaces have to be reported and they have to use the same prefixes. 

Normally with XML namespaces that wouldn't be necessary, but the GetFeature 
request contains XML like this:

   <wfs:Query xmlns:app="http://www.deegree.org/app"
              typeName="app:flurst">
     <wfs:PropertyName>app:the_geom</wfs:PropertyName>

That is, there's a namespace http://www.deegree.org/app with prefix "app:" 
that is not used for attribute or element names, but only for attribute 
values and the text content.  The standard python xml parsers do not report 
the prefix of the namespaces and some like ElementTree do not even report the 
namespaces that are not used for attribute or element names.


   Bernhard


[1] http://codespeak.net/lxml/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.wald.intevation.org/pipermail/inteproxy-devel/attachments/20070207/27ed6644/attachment.pgp


More information about the Inteproxy-devel mailing list