Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
<xs:element name="AltitudeSource" type="tns:AltitudeSourceType"/>

<xs:simpleType name="AltitudeSourceType">
<xs:restriction base="xs:string">
  <xs:enumeration value="Sensor"/>
  <xs:enumeration value="InstrumentRead"/>
  <xs:enumeration value="Estimated"/>
  <xs:enumeration value="Illegal"/>
</xs:restriction>
</xs:simpleType>

If we provide a function for use in dfdl:inputValueCalc named dfdl:lookupValue(key), this function would examine properties specified on the enumerations and perform the corresponding translation.

E.g.,Or this example which uses more than one key in some cases, and uses numeric ranges for others:

Code Block
<xs:simpleType name="AltitudeSourceType"
  dfdl:repType="tns:AltitudeSourceIntType"> <!-- the rep type -->
  <xs:restriction base="xs:string"> <!-- the logical type -->
    <xs:enumeration value="Sensor" dfdl:lookupKey="1"/>
    <xs:enumeration value="InstrumentRead" dfdl:lookupKey="2"/>
    <xs:enumeration value="Estimated" dfdl:lookupKey="3 4 5 6 7"/>
    <xs:enumeration value="Illegal"
      dfdl:lookupRange"8 255 512 1023"
      dfdl:lookupKey="255"/>
    <xs:enumeration value="Reserved"
      dfdl:lookupRange"0 0 256 511"
      dfdl:lookupValue="511"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="AltitudeSourceIntType"><!-- all properties for a simple type can go here -->
  <xs:restriction base="xs:int">
    <xs:minInclusive value="0"/>
    <xs:maxInclusive value="1023"/>
  </xs:restriction>
</xs:simpleType>

...