DDS-XTypes 1.3 RTF Avatar
  1. OMG Issue

DDSXTY13 — XSD for XML type representation should not specify default values for attributes representing annotations

  • Key: DDSXTY13-4
  • Status: closed  
  • Source: Real-Time Innovations ( Dr. Gerardo Pardo-Castellote, Ph.D.)
  • Summary:

    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 7.3.2.5.1.2 (Members):

    <struct name="structMemberDecl">
       <member name="my_key_field" type="int32" key="true" optional="false"/>
    </struct>
    

    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:

      <xs:complexType name="structMemberDecl">
        <xs:complexContent>
          <xs:extension base="memberDecl">
           <xs:attribute name="id"
                         type="memberId"
                         use="optional"/>
    
            <xs:attribute name="optional"
                          type="xs:boolean"
                          use="optional"
                          default="true"/>
            <xs:attribute name="mustUnderstand"
                          type="xs:boolean"
                          use="optional"
                          default="true"/>
            <xs:attribute name="nonSerialized"
                          type="xs:boolean"
                          use="optional"
                          default="true"/>
            <xs:attribute name="key"
                          type="xs:boolean"
                          use="optional"
                          default="true"/>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
    

    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
  • Disposition Summary:

    *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
  • Attachments: