Versions Compared

Key

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

...

Code Block
<xs:simpleType name="STATUS_UP">
  <xs:restriction base="xs:unsignedLong">
    <xs:enumeration value="1"/>
  </xs:restriction>
</xs:simpleTYpe>
 
<xs:simpleType name="STATUS_DOWN">
  <xs:restriction base="xs:unsignedLong">
    <xs:enumeration value="2"/>
  </xs:restriction>
</xs:simpleTYpe>
 
<xs:simpleType name="STATUS_DEGRADED">
  <xs:restriction base="xs:unsignedLong">
    <xs:enumeration value="3"/>
  </xs:restriction>
</xs:simpleTYpe>
 
<xs:simpleType name="NO_STATEMENT">
  <xs:union>
     <xs:simpleType>
       <xs:restriction base="xs:unsignedLong">
        <xs:minInclusive value="4"/>
        <xs:maxInclusive value="63"/>
       </xs:restriction>
     </xs:simpleType>
     <xs:simpleType>
       <xs:restriction base="xs:unsignedLong">
          <xs:enumeration value="0"/>
       </xs:restriction>
     </xs:simpleType>
   </xs:union>
</xs:simpleTYpe>
 
<xs:simpleType name="Status" daf:unionMemberLookup="yes" dfdl:length="6">
  <xs:union memberTypes="tns:NO_STATEMENT tns:STATUS_UP tns:STATUS_DOWN tns:STATUS_DEGRADED"/>
</xs:simpleType>
 
<xs:element name="rawStatus" type="tns:Status"/><xs:simpleType name="STATUS_UP">
  <xs:restriction base="xs:unsignedLong">
    <xs:enumeration value="1"/>
  </xs:restriction>
</xs:simpleTYpe>
 
<xs:simpleType name="STATUS_DOWN">
  <xs:restriction base="xs:unsignedLong">
    <xs:enumeration value="2"/>
  </xs:restriction>
</xs:simpleTYpe>
 
<xs:simpleType name="STATUS_DEGRADED">
  <xs:restriction base="xs:unsignedLong">
    <xs:enumeration value="3"/>
  </xs:restriction>
</xs:simpleTYpe>
 
<xs:simpleType name="NO_STATEMENT">
  <xs:union>
     <xs:simpleType>
       <xs:restriction base="xs:unsignedLong">
        <xs:minInclusive value="4"/>
        <xs:maxInclusive value="63"/>
       </xs:restriction>
     </xs:simpleType>
     <xs:simpleType>
       <xs:restriction base="xs:unsignedLong">
          <xs:enumeration value="0"/>
       </xs:restriction>
     </xs:simpleType>
   </xs:union>
</xs:simpleTYpe>
 
 
<xs:simpleType name="Status" daf:unionMemberLookup="yes" dfdl:length="6">
  <xs:union memberTypes="tns:NO_STATEMENT tns:STATUS_UP tns:STATUS_DOWN tns:STATUS_DEGRADED"/>
</xs:simpleType>
 
<xs:element name="rawStatus" type="tns:Status"/>

Usage for Parsing - daf:unionMemberSchemaName(arg)

Imagine the value of the rawStatus element is 2.

...

Due to name collisions issues, a property dfdl:unionMemberName, can be supplied on a simple type union member, and that name is preferred to the type's name. This enables use of anonymous simple type definitions in the union, as well as eliminating problems from XSD simple type name collisions within the same namespace.

Usage for Unparsing - daf:unionMemberValueFromName(arg)

Imagine our peer element named value contains "NO_STATEMENT" as a string in the infoset before unparsing begins.

...

Any other facets such as pattern may not appear on any of the union types. They are disallowed to enable possible future extension. It is an SDE if they are present.

Implementation Considerations

The implementation must take the definition of each simple type union having daf:unionMemberLookup="yes", and analyze it for enumerations and ranges. The implementation must then determine the right combination of decision tree on numeric ranges, vs. hash table on enumerated values, to implement the lookup capabilities.

...