XSD for XML type representation should not specify default values for attributes representing annotations
Source: Real-Time Innovations ( Gerardo Pardo-Castellote)
The XML type representation (Section 7.3.3) has an associated XSD that defines the legal XML documents that define DDS Types.
In the XML type representation builtin annotations on members appear as "attributes" on the element that describes the member. For example see example in section 184.108.40.206.1.2 (Members):
These builtin annotations (key, optional), have default values when they are not present. This is defined in the IDL4+ specification. For example when the annotation "key" is not present, the (default) value is "false" when annotation "optional" is not present, the (default) value is "false". There is also a "default" value when the annotation is present with no parameters, but this is not allowed in the XSD.
According to the XSD syntax, e.g. see https://www.w3schools.com/xml/schema_simple_attributes.asp
The "default" value specified for an attribute is the value interpreted when the attribute is not present. Therefore we have two options:
- Have the XSD specify default values for these attributes to match the "IDL4+ defaults when the attribute is not present
- Have the XSD specify no default value.
Currently this is not done correctly for some annotations. For example the XSD for structure members has wrong defaults for all the attributes:
However it seems like the best solution is to remove the specification of a default value from the XSD. The problem is that when the default is specified the XSD parsers will fill the default value even if the attribute is not specified and it becomes impossible for the application that uses the parser to know if the attribute was there or not in the first place. This would make it impossible to transform between IDL and XML and back to IDL and get the same result back because all annotations would appear present to the XML parser even if they were not entered buy the user.
Therefore we recommend removing the specification of 'default" value for all XML attributes that correspond to builtin annotations. This should be done both in Annex A and the machine readable dds-xtypes_type_definition_nonamespace.xsd
Reported: DDS-XTypes 1.2 — Mon, 24 Apr 2017 16:16 GMT
Disposition: Resolved — DDS-XTypes 1.3
*Remove the 'default" value for all XML attributes that correspond to builtin annotations. *
For the reasons listen in the issue description the XSD should not specify any default values for XSD attributes that correspond to builtin annotations.
Updated: Tue, 8 Oct 2019 17:55 GMT
- xtypes_xml_type_representation_no_namespace.xsd 20 kB (text/xml)