How to get lxml working under IronPython?

百般思念 提交于 2020-01-03 10:55:19

问题


I need to port some code that relies heavily on lxml from a CPython application to IronPython.

lxml is very Pythonic and I would like to keep using it under IronPython, but it depends on libxslt and libxml2, which are C extensions.

Does anyone know of a workaround to allow lxml under IronPython or a version of lxml that doesn't have those C-extension dependencies?


回答1:


You might check out IronClad, which is an open source project intended to make C Extensions for Python available in IronPython.




回答2:


Something which you might have already considered:

An alternative is to first port the lxml library to IPy and then your code (depending on the code size). You might have to write some C# wrappers for the native C calls to the C extensions -- I'm not sure what issues, if any, are involved in this with regards to IPy.

Or if the code which you are porting is small, as compared to lxml, then maybe you can just remove the lxml dependency and use the .NET XML libraries.



来源:https://stackoverflow.com/questions/1200726/how-to-get-lxml-working-under-ironpython

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!