Wednesday, 25 February 2015

pyxb: how to set an inner nillable element to null



I am trying to set an inner nillable element called nbReports to null and so far I have failed. a snapshot of the xsd file and the code is next:


the code snapshot:



import reports
rep=reports.reports()
rep.description="this report is ..."
temp=ReportingGroupType(id=xs.string("A1")
temp.title="this title")
temp.nbReports._setIsNil #"error: AttributeError: 'NoneType' object has no attribute '_setIsNil'


if I try to set nbReports to any value (e.g. 4) to create an instance of nbReprots and then I set it to null then nbReprots value will remain 4 when i print it


Your help is very much appreciated


No comments:

Post a Comment