Python Forum

Full Version: XML modules
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm porting a web application from Perl to Python3 (using mod_wsgi and Flask). The application uses XML extensively.

I've found that I need to use the Python module "libxml2" for some tasks and "lxml" for other tasks.

The reason is that "lxml" seems to lack the function" "getLang()" that is a must-have for parts of my application, while "libxml2" seems currently not able to do transformations with XSLT. So for the parts that need "getLang()" I use "libxml2", and for the XSLT parts I use "lxml". It works, but it's a bit annoying having to use two different XML modules.

Have I missed something? Any advice will be most welcome.

I know that "lxml" uses the library "libxml2". I'm talking about the Python module "libxml2" that of course also uses the same library, but with different bindings.
In case anyone is interested: In the end I managed to do everything with lxml, and I'm very happy with the results. Python is really nice.

But I still think the lack of the function "getLang()" is a problem. When I looked closer att my particular case I found that I could get by nicely without it, but that was mostly just luck. The Perl module that does the same thing with libxml2 has that function (called "xmlLang()") and it really should be implemented in lxml as well. Document oriented XML files with multi-lingual text often need that function.