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:
<xs:element name="reports" type="tns:Reports"/>
<xs:complexType name="Reports">
<xs:sequence>
<xs:element minOccurs="0" name="description" type="xs:string"/>
<xs:element minOccurs="0" name="reportingGroups">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
name="reportingGroup" type="tns:ReportingGroupType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReportingGroupType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="nbReports" type="xs:int" nillable="true"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
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.