2011-02-22 1 views
5

내가 LXML 일부 XML을 생성하고 무엇입니까 노드는 다음과 같이 생성 :lxml을 사용할 때 네임 스페이스 속성없이 XML을 렌더링 할 수 있습니까?

<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"> 

과 :

<MaxReturned py:pytype="int"> 

이 사용자 정의 속성이 Quickbooks에 '파서를 죽이고있다. LXML을 사용자 정의 항목없이 렌더링 할 수 있습니까?

답변

6

는 다음과 같은 돌봐 것 같은데 :

objectify.deannotate(root, xsi_nil=True) 
etree.cleanup_namespaces(root) 

또는 LXML를 사용하는 경우> = 2.3.2 (감사 @Pedru) :

objectify.deannotate(root, cleanup_namespaces=True, xsi_nil=True) 
+0

당신이') (objectify.deannotate'에'cleanup_namespaces = TRUE '를 ('etree.cleanup_namespaces을()'호출 할 필요)을 통과 할 수 없다 2.3.2 – Pedru

0

당신이

를 사용하는 경우
etree.fromstring(xml_response) 

는이 일을 :

0이 그것을 피할 적 분석 네임 스페이스 lxml이 버전에서

관련 문제