[Generateds-discuss] Export of an enumerated string restriction attribute with a default value
Brought to you by:
dkuhlman
From: Andrii I. <an...@eb...> - 2023-05-17 10:27:18
|
Dear Dave, Please could you help with writing out to XML an enumerated string restriction attribute with a default value? It looks like this: <xs:attribute default="GB" name="units"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="TB"/> <xs:enumeration value="GB"/> <xs:enumeration value="MB"/> </xs:restriction> </xs:simpleType> </xs:attribute> When writing out and the value is set to "GB", no units are output into the XML. It appears that the skip is happening in the following generated logic: def _exportAttributes(self, outfile, level, already_processed, namespaceprefix_='', name_='datasetSizeType'): if self.units != "GB" and 'units' not in already_processed: already_processed.add('units') outfile.write(' units=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.units), input_name='units')), )) At this point in code already_processed is just an empty set(). Is there any switch or change in schema that we might do to ensure "GB" units are added even if the value is the same as the default one? Many thanks and best regards, Andrii |