Using SimpleXMLTreeBuilder in elementtree

前端 未结 5 2085
野性不改
野性不改 2020-12-04 02:00

I have been developing an application with django and elementtree and while deploying it to the production server i have found out it is running python 2.4. I have been able

5条回答
  •  情深已故
    2020-12-04 02:50

    Assuming you're now using elementtree.XMLTreeBuilder, just try this instead:

    from elementtree import SimpleXMLTreeBuilder as XMLTreeBuilder
    

    It tries to provide exactly the same functionality but using xmllib instead of expat. If that also fails, BTW, try:

    from elementtree import SgmlopXMLTreeBuilder as XMLTreeBuilder
    

    to attempt to use yet another implementation, this one based on sgmlop instead.

提交回复
热议问题