When using lxml, can the XML be rendered without namespace attributes?
问题 I am generating some XML with lxml and getting nodes generated like this: <QBXML xmlns:py="http://codespeak.net/lxml/objectify/pytype" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" py:pytype="TREE"> and: <MaxReturned py:pytype="int"> These custom attributes are killing Quickbooks' parser. Can I get LXML to render without the custom stuff? 回答1: Looks like the following take care of it: objectify.deannotate(root, xsi_nil=True) etree.cleanup