Tech-invite3GPPspaceIETFspace
96959493929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 4912

Abstract Syntax Notation X (ASN.X)

Pages: 165
Experimental
Part 2 of 6 – Pages 17 to 43
First   Prev   Next

Top   ToC   RFC4912 - Page 17   prevText

6. Translation of Types

The rules for translating the different varieties of Type are detailed in this section. Note that the notation of ASN.1 is ambiguous where a Type is both prefixed [X.680-1] (e.g., tagged) and constrained. For example, the notation "[0] INTEGER (0..10)" could be interpreted as either a tagged ConstrainedType or a constrained TaggedType. For the purposes of the translation into ASN.X, the constraint is assumed to have higher precedence than the prefix, so the above notation would be taken to be a tagged ConstrainedType.

6.1. Identifier Replacement

Various RXER encoding instructions can be used to override an identifier in an ASN.1 specification with an NCName [XMLNS10]. The NCName is given preeminence in the ASN.X representation, and the identifier is not explicitly given if it is algorithmically related to the NCName. The cases where an NCName overrides an identifier are covered individually in other parts of this specification and make use of the following definition. Definition (reduction): The reduction of an NCName is the string of characters resulting from the following operations performed in order on the NCName:
Top   ToC   RFC4912 - Page 18
   (1) replace each full stop ('.', U+002E) and low line ('_', U+005F)
       character with a hyphen character ('-', U+002D),

   (2) remove every character except Latin letters (U+0041-U+005A,
       U+0061-U+007A), decimal digits (U+0030-U+0039), and hyphens
       (U+002D),

   (3) remove leading and trailing hyphen characters,

   (4) replace sequences of two or more hyphen characters with a single
       hyphen, and

   (5) convert the first character to lowercase if it is an uppercase
       letter.

      Aside: If the reduction of an NCName is not the same as the
      identifier that the NCName replaces, then the identifier will be
      explicitly given in the translation into ASN.X.

6.2. DefinedType Translation

If a Type is a DefinedType in a ReferencedType, then the translation of the Type is the translation of the DefinedType. If a DefinedType is not a ParameterizedType, ParameterizedValueSetType, or DummyReference and is not subject to a TYPE-REF or REF-AS-TYPE encoding instruction, then the translation of the DefinedType is either the attribute form translation of a type reference, or the element form translation of a type reference. The attribute form translation of a type reference is an attribute item with the [local name] "type". The [normalized value] of this attribute item is a qualified name for the expanded name of the referenced type definition (see Section 5.1). The attribute form translation SHALL NOT be used if this expanded name is not distinct with respect to the current module and the modules referenced by its <import> element items (see Section 5.1). The element form translation of a type reference is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An attribute item with the [local name] "ref" SHALL be added to the [attributes] of the <type> element item. The [normalized value] of this attribute item is a qualified name for the expanded name of the referenced type definition. If this expanded name is not distinct with respect to the current module and the modules referenced by its <import> element items, then an attribute item with the [local name] "context" SHALL be added to the
Top   ToC   RFC4912 - Page 19
   [attributes] of the <type> element item; otherwise, if the module
   containing the referenced type definition has a schema identity URI,
   then an attribute item with the [local name] "context" MAY be added
   to the [attributes] of the <type> element item.  The
   [normalized value] of this attribute item is the schema identity URI
   of the module containing the type definition referenced by the
   DefinedType.

      Aside: If a reference name is not distinct, then the module
      containing the referenced definition must have a schema identity
      URI (see Section 5.1).

   An attribute item with the [local name] "embedded" and
   [normalized value] "false" or "0" MAY be added to the [attributes] of
   the <type> element item.

   The translation of the DefinedType is the same whether the type
   definition is referenced by a typereference or an
   ExternalTypeReference.

   If a DefinedType is subject to a TYPE-REF encoding instruction, then
   the translation of the DefinedType is an element item with the
   [local name] "type".  An element item with the [local name]
   "annotation" MAY be added to the [children] of the <type> element
   item.  An attribute item with the [local name] "ref" SHALL be added
   to the [attributes] of the <type> element item.  The
   [normalized value] of this attribute item is the RXER character data
   translation of the QNameValue in the TYPE-REF encoding instruction.
   If a ContextParameter is present in the RefParameters in the TYPE-REF
   encoding instruction, then an attribute item with the [local name]
   "context" SHALL be added to the [attributes] of the <type> element
   item.  The [normalized value] of this attribute item is the string
   value of the AnyURIValue in the ContextParameter.  An attribute item
   with the [local name] "embedded" and [normalized value] "true" or "1"
   SHALL be added to the [attributes] of the <type> element item.

      Aside: The embedded attribute item indicates whether a type is
      directly referenced as a DefinedType or indirectly referenced
      through a TYPE-REF encoding instruction.  An ASN.1 type can be
      referenced either way.  Type definitions in other schema languages
      cannot be directly referenced.

   If a DefinedType is subject to a REF-AS-TYPE encoding instruction,
   then the translation of the DefinedType is an element item with the
   [local name] "type".  An element item with the [local name]
   "annotation" MAY be added to the [children] of the <type> element
   item.  An attribute item with the [local name] "elementType" SHALL be
   added to the [attributes] of the <type> element item.  The
Top   ToC   RFC4912 - Page 20
   [normalized value] of this attribute item is the RXER character data
   translation of the NameValue in the REF-AS-TYPE encoding instruction.
   If a ContextParameter is present in the RefParameters in the
   REF-AS-TYPE encoding instruction, then an attribute item with the
   [local name] "context" SHALL be added to the [attributes] of the
   <type> element item.  The [normalized value] of this attribute item
   is the string value of the AnyURIValue in the ContextParameter.

   Example

      CHOICE {
          one    Foo,
          two    [RXER:TYPE-REF
                     { namespace-name "http://www.example.com/PO1",
                       local-name "PurchaseOrderType" }]
                 Markup,
          three  [RXER:REF-AS-TYPE "product"
                     CONTEXT "http://www.example.com/inventory"]
                 Markup
      }

      <type>
       <choice>
        <element name="one" type="tns:Foo"/>
        <element name="two" xmlns:po="http://www.example.com/PO1">
         <type ref="po:PurchaseOrderType" embedded="true"/>
        </element>
        <element name="three">
         <type elementType="product"
               context="http://www.example.com/inventory"/>
        </element>
       </choice>
      </type>

   If a DefinedType is a DummyReference, ParameterizedType, or
   ParameterizedValueSetType, then the translation of the Type is the
   translation of that DummyReference, ParameterizedType, or
   ParameterizedValueSetType (see Section 13).

6.3. Translation of Built-in Types

If a Type is a BuiltinType or ReferencedType that is one of the productions in Table 1 in Section 5 of the specification for RXER [RXER], then the translation of the Type is either the attribute form or element form translation of that type.
Top   ToC   RFC4912 - Page 21
   The attribute form translation of a Type that is a BuiltinType or
   ReferencedType that is one of the productions in Table 1 is an
   attribute item with the [local name] "type".  The [normalized value]
   of this attribute item is a qualified name for the expanded name of
   the built-in type (see Section 5 of the specification for RXER
   [RXER]).

   The element form translation of a Type that is a BuiltinType or
   ReferencedType that is one of the productions in Table 1 is an
   element item with the [local name] "type".  An element item with the
   [local name] "annotation" MAY be added to the [children] of the
   <type> element item.  An attribute item with the [local name] "ref"
   SHALL be added to the [attributes] of the <type> element item.  The
   [normalized value] of this attribute item is a qualified name for the
   expanded name of the built-in type.

   Example

      BOOLEAN

      <type ref="asnx:BOOLEAN"/>

   Usually the translator is free to choose either the attribute form or
   element form translation for a Type; however, in some contexts
   attribute forms for a Type are explicitly disallowed.

6.4. BitStringType Translation

The translation of a BitStringType with a NamedBitList is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "namedBitList" SHALL be appended to the [children] of the <type> element item. The translation of each NamedBit in the NamedBitList SHALL be appended to the [children] of the <namedBitList> element item. The translation of a NamedBit is an element item with the [local name] "namedBit". An attribute item with the [local name] "name" SHALL be added to the [attributes] of the <namedBit> element item. If the BitStringType is subject to a VALUES encoding instruction, then the [normalized value] of this attribute item is the replacement name [RXEREI] for the identifier in the NamedBit; otherwise, it is the identifier in the NamedBit. If the BitStringType is subject to a VALUES encoding instruction and the reduction of the replacement name (see Section 6.1) is not the same as the identifier, then an attribute item with the [local name] "identifier" SHALL be added to the [attributes] of the <namedBit>
Top   ToC   RFC4912 - Page 22
   element item; otherwise, an attribute item with the [local name]
   "identifier" MAY be added to the [attributes] of the <namedBit>
   element item.  The [normalized value] of this attribute item is the
   identifier in the NamedBit.  An attribute item with the [local name]
   "bit" SHALL be added to the [attributes] of the <namedBit> element
   item.  The [normalized value] of this attribute item is the digit
   string representation of the integer value of the number or
   DefinedValue in the NamedBit.

   Examples

      BIT STRING { zero(0), one(1), two(2) }

      <type>
       <namedBitList>
        <namedBit name="zero" bit="0"/>
        <namedBit name="one" bit="1"/>
        <namedBit name="two" bit="2"/>
       </namedBitList>
      </type>

      [RXER:VALUES ALL CAPITALIZED, wednesday AS "Midweek"]
          BIT STRING {
              monday(0), tuesday(1), wednesday(2),
              thursday(3), friday(4)
          }

      <type>
       <namedBitList>
        <namedBit name="Monday" bit="0"/>
        <namedBit name="Tuesday" bit="1"/>
        <namedBit name="Midweek" identifier="wednesday" bit="2"/>
        <namedBit name="Thursday" bit="3"/>
        <namedBit name="Friday" bit="4"/>
       </namedBitList>
      </type>

6.5. IntegerType Translation

The translation of an IntegerType with a NamedNumberList is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "namedNumberList" SHALL be appended to the [children] of the <type> element item. The translation of each NamedNumber in the NamedNumberList SHALL be appended to the [children] of the <namedNumberList> element item.
Top   ToC   RFC4912 - Page 23
   The translation of a NamedNumber is an element item with the
   [local name] "namedNumber".  An attribute item with the [local name]
   "name" SHALL be added to the [attributes] of the <namedNumber>
   element item.  If the IntegerType is subject to a VALUES encoding
   instruction, then the [normalized value] of this attribute item is
   the replacement name [RXEREI] for the identifier in the NamedNumber;
   otherwise, it is the identifier in the NamedNumber.  If the
   IntegerType is subject to a VALUES encoding instruction and the
   reduction of the replacement name (see Section 6.1) is not the same
   as the identifier, then an attribute item with the [local name]
   "identifier" SHALL be added to the [attributes] of the <namedNumber>
   element item; otherwise, an attribute item with the [local name]
   "identifier" MAY be added to the [attributes] of the <namedNumber>
   element item.  The [normalized value] of this attribute item is the
   identifier in the NamedNumber.  An attribute item with the
   [local name] "number" SHALL be added to the [attributes] of the
   <namedNumber> element item.  The [normalized value] of this attribute
   item is the digit string representation of the integer value of the
   SignedNumber or DefinedValue in the NamedNumber.

   Examples

      INTEGER { nothing(0), a-little(1), a-lot(100) }

      <type>
       <namedNumberList>
        <namedNumber name="nothing" number="0"/>
        <namedNumber name="a-little" number="1"/>
        <namedNumber name="a-lot" number="100"/>
       </namedNumberList>
      </type>

      [RXER:VALUES ALL CAPITALIZED, very-high AS "DANGEROUS"]
          INTEGER { low(25), medium(50), high(75), very-high(100) }

      <type>
       <namedNumberList>
        <namedNumber name="Low" number="25"/>
        <namedNumber name="Medium" number="50"/>
        <namedNumber name="High" number="75"/>
        <namedNumber name="DANGEROUS" identifier="very-high"
                     number="100"/>
       </namedNumberList>
      </type>
Top   ToC   RFC4912 - Page 24

6.6. EnumeratedType Translation

The translation of an EnumeratedType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "enumerated" SHALL be appended to the [children] of the <type> element item. The translation of each EnumerationItem nested in the RootEnumeration in the Enumerations instance in the EnumeratedType SHALL be appended to the [children] of the <enumerated> element item. If an ellipsis ("...") is present in the Enumerations instance, then an element item with the [local name] "extension" SHALL be appended to the [children] of the <enumerated> element item and the translation of the ExceptionSpec (possibly empty) SHALL be added to the [children] of the <extension> element item. If an AdditionalEnumeration is present in the Enumerations instance, then the translation of each EnumerationItem nested in the AdditionalEnumeration SHALL be appended to the [children] of the <extension> element item. The translation of an EnumerationItem is an element item with the [local name] "enumeration". If the EnumerationItem is of the "identifier" form, then an attribute item with the [local name] "name" SHALL be added to the [attributes] of the <enumeration> element item. If the EnumeratedType is subject to a VALUES encoding instruction, then the [normalized value] of this attribute item is the replacement name [RXEREI] for the identifier; otherwise, it is the identifier. If the EnumeratedType is subject to a VALUES encoding instruction and the reduction of the replacement name (see Section 6.1) is not the same as the identifier, then an attribute item with the [local name] "identifier" SHALL be added to the [attributes] of the <enumeration> element item; otherwise, an attribute item with the [local name] "identifier" MAY be added to the [attributes] of the <enumeration> element item. The [normalized value] of this attribute item is the identifier. If the EnumerationItem is of the "NamedNumber" form, then an attribute item with the [local name] "name" SHALL be added to the [attributes] of the <enumeration> element item. If the EnumeratedType is subject to a VALUES encoding instruction, then the [normalized value] of this attribute item is the replacement name [RXEREI] for the identifier in the NamedNumber; otherwise, it is the identifier in the NamedNumber. If the EnumeratedType is subject to a VALUES encoding instruction and the reduction of the replacement name is not the same as the identifier, then an attribute item with the [local name] "identifier" SHALL be added to the [attributes] of the
Top   ToC   RFC4912 - Page 25
   <enumeration> element item; otherwise, an attribute item with the
   [local name] "identifier" MAY be added to the [attributes] of the
   <enumeration> element item.  The [normalized value] of this attribute
   item is the identifier in the NamedNumber.  An attribute item with
   the [local name] "number" SHALL be added to the [attributes] of the
   <enumeration> element item.  The [normalized value] of this attribute
   item is the digit string representation of the integer value of the
   SignedNumber or DefinedValue in the NamedNumber.

   Examples

      ENUMERATED { red(0), green(1), ..., blue(2) }

      <type>
       <enumerated>
        <enumeration name="red" number="0"/>
        <enumeration name="green" number="1"/>
        <extension>
         <enumeration name="blue" number="2"/>
        </extension>
       </enumerated>
      </type>

      [RXER:VALUES ALL CAPITALIZED, red AS "Crimson"]
          ENUMERATED { red, yellow, green, blue }

      <type>
       <enumerated>
        <enumeration name="Crimson" identifier="red"/>
        <enumeration name="Yellow"/>
        <enumeration name="Green"/>
        <enumeration name="Blue"/>
       </enumerated>
      </type>

6.7. PrefixedType Translation

The translation of a PrefixedType [X.680-1] that is a TaggedType is either the short form translation (Section 6.7.1) or long form translation (Section 6.7.2) of the TaggedType. Aside: The short form translation is provided because TaggedType notation is heavily used in existing ASN.1 specifications. The long form translation has the same structure as the translation of an EncodingPrefixedType and can be simplified where there is a series of nested PrefixedType instances.
Top   ToC   RFC4912 - Page 26
   If a PrefixedType is an EncodingPrefixedType and the
   EncodingReference is RXER, or the EncodingReference is empty and the
   default encoding reference [X.680-1] for the module is RXER, then the
   translation of the PrefixedType is the translation of the Type in the
   EncodingPrefixedType.

      Aside: This is not suggesting that RXER encoding instructions are
      ignored.  Encoding instructions for RXER are not explicitly
      represented in ASN.X, but rather affect how an ASN.1 module is
      translated into an ASN.X module (since the content of an ASN.X
      module is also the RXER encoding of an abstract value of the
      ModuleDefinition ASN.1 type in Appendix A).  The individual
      effects of RXER encoding instructions on the translation are
      addressed in other parts of this specification.  Encoding
      instructions for other encoding rules have explicit
      representations in ASN.X.

   If a PrefixedType is an EncodingPrefixedType and the
   EncodingReference is not RXER, or the EncodingReference is empty and
   the default encoding reference for the module is not RXER, then the
   translation of the PrefixedType is an element item with the
   [local name] "prefixed".  The translation of the EncodingPrefix in
   the EncodingPrefixedType SHALL be added to the [children] of the
   <prefixed> element item.

   If the EncodingReference of an EncodingPrefix is not empty, then the
   translation of the EncodingPrefix is an element item with the
   encodingreference in the EncodingReference as the [local name].  The
   translation of the EncodingInstruction in the EncodingPrefix SHALL be
   added to the [children] of this element item.

   If the EncodingReference of an EncodingPrefix is empty, then the
   translation of the EncodingPrefix is an element item with the default
   encoding reference for the module as the [local name].  The
   translation of the EncodingInstruction in the EncodingPrefix SHALL be
   added to the [children] of this element item.

   The EncodingInstruction notation is different for each set of
   encoding instructions, and their translations into ASN.X are
   specified in separate documents [GSEREIT][XEREIT].  At the time of
   writing, only three sets of encoding instructions have been defined
   (for RXER [RXEREI], GSER [GSEREI], and EXTENDED-XER [X.693-1]).

   If the child <type> element item of a <prefixed> element item has no
   attribute items and has a child <prefixed> element item, then that
   child <type> element item MAY be replaced by the [children] and
   [attributes] of the inner <prefixed> element item.  Note that the
   long form translation of a TaggedType is also eligible for this
Top   ToC   RFC4912 - Page 27
   rewriting step.  This rewriting step MAY be applied to the result of
   a previous rewriting step if the necessary condition still holds.

   Example

      These three definitions are equivalent.

      [XER:ATTRIBUTE] [XER:USE-UNION] [GSER:CHOICE-OF-STRINGS] CHOICE {
          one  PrintableString,
          two  UTF8String
      }

      <type>
       <prefixed>
        <XER><attribute/></XER>
        <type>
         <prefixed>
          <XER><useUnion/></XER>
          <type>
           <prefixed>
            <GSER><choiceOfStrings/></GSER>
            <type>
             <choice>
              <element name="one" type="asnx:PrintableString"/>
              <element name="two" type="asnx:UTF8String"/>
             </choice>
            </type>
           </prefixed>
          </type>
         </prefixed>
        </type>
       </prefixed>
      </type>

      <type>
       <prefixed>
        <XER><attribute/></XER>
        <XER><useUnion/></XER>
        <GSER><choiceOfStrings/></GSER>
        <type>
         <choice>
          <element name="one" type="asnx:PrintableString"/>
          <element name="two" type="asnx:UTF8String"/>
         </choice>
        </type>
       </prefixed>
      </type>
Top   ToC   RFC4912 - Page 28

6.7.1. Short Form TaggedType Translation

The short form translation of a TaggedType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "tagged" SHALL be appended to the [children] of the <type> element item. If the Class in the Tag in the TaggedType is not empty, then an attribute item with the [local name] "tagClass" SHALL be added to the [attributes] of the <tagged> element item. The [normalized value] of this attribute item is the Class of the Tag with all letters downcased, i.e., either "universal", "application", or "private". An attribute item with the [local name] "number" SHALL be added to the [attributes] of the <tagged> element item. The [normalized value] of this attribute item is the digit string representation of the integer value of the number or DefinedValue in the ClassNumber in the Tag. If the Tag is immediately followed by the "IMPLICIT" keyword, then an attribute item with the [local name] "tagging" and [normalized value] "implicit" SHALL be added to the [attributes] of the <tagged> element item. If the Tag is immediately followed by the "EXPLICIT" keyword, then an attribute item with the [local name] "tagging" and [normalized value] "explicit" SHALL be added to the [attributes] of the <tagged> element item. The translation of the Type in the TaggedType SHALL be added to the [children] or [attributes] of the <tagged> element item. Examples [0] INTEGER <type> <tagged number="0" type="asnx:INTEGER"/> </type> [APPLICATION 10] IMPLICIT BOOLEAN <type> <tagged tagClass="application" number="10" tagging="implicit" type="asnx:BOOLEAN"/> </type>
Top   ToC   RFC4912 - Page 29

6.7.2. Long Form TaggedType Translation

The long form translation of a TaggedType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "prefixed" SHALL be appended to the [children] of the <type> element item. The translation of the Tag in the TaggedType SHALL be added to the [children] of the <prefixed> element item. The translation of a Tag is an element item with the [local name] "TAG". If the Class of the Tag is not empty, then an attribute item with the [local name] "tagClass" SHALL be added to the [attributes] of the <TAG> element item. The [normalized value] of this attribute item is the Class of the Tag with all letters downcased, i.e., either "universal", "application", or "private". An attribute item with the [local name] "number" SHALL be added to the [attributes] of the <TAG> element item. The [normalized value] of this attribute item is the digit string representation of the integer value of the number or DefinedValue in the ClassNumber in the Tag. If the Tag is immediately followed by the "IMPLICIT" keyword, then an attribute item with the [local name] "tagging" and [normalized value] "implicit" SHALL be added to the [attributes] of the <TAG> element item. If the Tag is immediately followed by the "EXPLICIT" keyword, then an attribute item with the [local name] "tagging" and [normalized value] "explicit" SHALL be added to the [attributes] of the <TAG> element item. The translation of the Type in the TaggedType SHALL be added to the [children] or [attributes] of the <prefixed> element item. Examples [0] INTEGER <type> <prefixed type="asnx:INTEGER"> <TAG number="0"/> </prefixed> </type>
Top   ToC   RFC4912 - Page 30
      [APPLICATION 10] IMPLICIT BOOLEAN

      <type>
       <prefixed type="asnx:BOOLEAN">
        <TAG tagClass="application" number="10" tagging="implicit"/>
       </prefixed>
      </type>

6.8. SelectionType Translation

The translation of a SelectionType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "selection" SHALL be appended to the [children] of the <type> element item. The identifier in a SelectionType identifies a NamedType in the definition of the Type in the SelectionType. The translation of that NamedType will be an element item with the [local name] either "attribute", "element", "component", "group", or "member". An attribute item with the same [local name] as the translation of the NamedType SHALL be added to the [attributes] of the <selection> element item. The [normalized value] of this attribute item is a qualified name for the expanded name of the NamedType [RXEREI]. The translation of the Type in the SelectionType SHALL be added to the [children] or [attributes] of the <selection> element item. Examples field1 < MyChoiceType <type> <selection element="field1" type="tns:MyChoiceType"/> </type> field2 < CHOICE { field2 [RXER:ATTRIBUTE][RXER:NAME AS "field-two"] INTEGER } <type> <selection attribute="field-two"> <type> <choice> <attribute name="field-two" identifier="field2" type="asnx:INTEGER"/> </choice> </type>
Top   ToC   RFC4912 - Page 31
       </selection>
      </type>

6.9. InstanceOfType Translation

The translation of an InstanceOfType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "instanceOf" SHALL be appended to the [children] of the <type> element item. The translation of the DefinedObjectClass in the InstanceOfType SHALL be added to the [children] or [attributes] of the <instanceOf> element item. Example INSTANCE OF TYPE-IDENTIFIER <type> <instanceOf class="asnx:TYPE-IDENTIFIER"/> </type>

6.10. ObjectClassFieldType Translation

The translation of an ObjectClassFieldType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "fromClass" SHALL be appended to the [children] of the <type> element item. The translation of the DefinedObjectClass in the ObjectClassFieldType SHALL be added to the [children] or [attributes] of the <fromClass> element item. The translation of the FieldName (see Section 9.2.6) in the ObjectClassFieldType SHALL be added to the [children] or [attributes] of the <fromClass> element item. Example OPERATION.&Linked.&ArgumentType <type> <fromClass class="tns:OPERATION" fieldName="Linked/ArgumentType"/> </type>
Top   ToC   RFC4912 - Page 32

6.11. TypeFromObject and ValueSetFromObjects Translation

The translation of a TypeFromObject or ValueSetFromObjects is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "fromObjects" SHALL be appended to the [children] of the <type> element item. The translation of the ReferencedObjects instance in the TypeFromObject or ValueSetFromObjects SHALL be added to the [children] or [attributes] of the <fromObjects> element item. The translation of the FieldName in the TypeFromObject or ValueSetFromObjects SHALL be added to the [children] or [attributes] of the <fromObjects> element item. Example invertMatrix.&Errors.&errorCode <type> <fromObjects object="tns:invertMatrix" fieldName="Errors/errorCode"/> </type>

6.12. Translation of Combining Types

This section details the translation of the ASN.1 combining types: SET, SEQUENCE, CHOICE, SET OF, and SEQUENCE OF. The combining type definitions all make use of the NamedType notation.

6.12.1. NamedType Translation

A NamedType is translated in one of three ways depending on the context. These are the normal translation, the member translation, and the item translation. These translations are not interchangeable. One of the three will be explicitly invoked as part of the translation of an enclosing combining type. The normal translation of a NamedType is an element item with the [local name] determined as follows: (1) if the NamedType is subject to an ATTRIBUTE or ATTRIBUTE-REF encoding instruction, or subject to a COMPONENT-REF encoding instruction that references a top-level NamedType that is subject to an ATTRIBUTE encoding instruction, then the [local name] is "attribute",
Top   ToC   RFC4912 - Page 33
   (2) else if the NamedType is subject to a GROUP encoding instruction,
       then the [local name] is "group",

   (3) else if the NamedType is subject to a SIMPLE-CONTENT encoding
       instruction, then the [local name] is "simpleContent",

   (4) otherwise, the [local name] is "element" or "component"
       (translator's choice).

      Aside: The local names "element" and "component" are synonymous.
      The "component" alternative is offered for specifying applications
      that don't use RXER (except for the ASN.X specification itself, of
      course), where referring to parts of an encoding as elements would
      seem incongruous.

   The member translation of a NamedType is an element item with the
   [local name] "member".

   The item translation of a NamedType is an element item with the
   [local name] "item".

      Aside: A Namedtype for which the member or item translation is
      invoked will never be subject to an ATTRIBUTE, ATTRIBUTE-REF,
      COMPONENT-REF, GROUP, SIMPLE-CONTENT, or TYPE-AS-VERSION encoding
      instruction.  These encoding instructions are also mutually
      exclusive [RXEREI].

   An element item with the [local name] "annotation" MAY be added to
   the [children] of the <attribute>, <element>, <component>, <group>,
   <item>, <member>, or <simpleContent> element item.

   If a NamedType is subject to a TYPE-AS-VERSION encoding instruction,
   then an attribute item with the [local name] "typeAsVersion" and
   [normalized value] "true" or "1" SHALL be added to the <element> or
   <component> element item.  For the normal translation, if a NamedType
   is not subject to an ATTRIBUTE, ATTRIBUTE-REF, COMPONENT-REF, GROUP,
   SIMPLE-CONTENT, or TYPE-AS-VERSION encoding instruction, then an
   attribute item with the [local name] "typeAsVersion" and
   [normalized value] "false" or "0" MAY be added to the <element> or
   <component> element item.

   For the normal, member, and item translations, if a NamedType is not
   subject to an ATTRIBUTE-REF, COMPONENT-REF, ELEMENT-REF, or
   REF-AS-ELEMENT encoding instruction, then an attribute item with the
   [local name] "name" SHALL be added to the [attributes] of the
   <attribute>, <element>, <component>, <group>, <item>, <member>, or
Top   ToC   RFC4912 - Page 34
   <simpleContent> element item.  The [normalized value] of this
   attribute item is the local name of the expanded name of the
   NamedType [RXEREI].

      Aside: If there are no NAME, ATTRIBUTE-REF, COMPONENT_REF,
      ELEMENT-REF or REF-AS-ELEMENT encoding instructions, then the
      local name of the expanded name of a NamedType is the same as the
      identifier in the NamedType.

   If the reduction of the local name (an NCName) of the expanded name
   of a NamedType is not the same as the identifier in the NamedType,
   then an attribute item with the [local name] "identifier" SHALL be
   added to the [attributes] of the <attribute>, <element>, <component>,
   <group>, <item>, <member>, or <simpleContent> element item;
   otherwise, an attribute item with the [local name] "identifier" MAY
   be added to the [attributes] of the aforementioned element item.  The
   [normalized value] of this attribute item is the identifier in the
   NamedType.

      Aside: The identifier attribute is not contingent on there being a
      name attribute.  That is, an element item can have an identifier
      attribute item without having a name attribute item.

   If a NamedType is subject to a COMPONENT-REF encoding instruction,
   then an attribute item with the [local name] "ref" SHALL be added to
   the [attributes] of the <attribute>, <element>, or <component>
   element item.  The [normalized value] of this attribute item is a
   qualified name for the expanded name of the top-level NamedType
   referenced by the encoding instruction.  If the expanded name is not
   distinct with respect to the current module and the modules
   referenced by its <import> element items (see Section 5.1), then an
   attribute item with the [local name] "context" SHALL be added to the
   [attributes] of the <attribute>, <element>, or <component> element
   item; otherwise, if the module containing the referenced top-level
   NamedType has a schema identity URI, then an attribute item with the
   [local name] "context" MAY be added to the [attributes] of the
   <attribute>, <element>, or <component> element item.  The
   [normalized value] of this attribute item is the schema identity URI
   of the module containing the referenced top-level NamedType.

      Aside: If an expanded name is not distinct, then the module
      containing the referenced top-level NamedType must have a schema
      identity URI (see Section 5.1).

   If a NamedType is subject to a COMPONENT-REF encoding instruction,
   then an attribute item with the [local name] "embedded" and
   [normalized value] "false" or "0" MAY be added to the [attributes] of
   the <attribute>, <element>, or <component> element item.
Top   ToC   RFC4912 - Page 35
   If a NamedType is subject to an ATTRIBUTE-REF or ELEMENT-REF encoding
   instruction, then an attribute item with the [local name] "ref" SHALL
   be added to the [attributes] of the <attribute>, <element>, or
   <component> element item.  The [normalized value] of this attribute
   item is the RXER character data translation of the QNameValue in the
   encoding instruction.  An attribute item with the [local name]
   "embedded" and [normalized value] "true" or "1" SHALL be added to the
   [attributes] of the <attribute>, <element>, or <component> element
   item.

   If a NamedType is subject to a REF-AS-ELEMENT encoding instruction,
   then an attribute item with the [local name] "elementType" SHALL be
   added to the [attributes] of the <element> or <component> element
   item.  The [normalized value] of this attribute item is the RXER
   character data translation of the NameValue in the REF-AS-ELEMENT
   encoding instruction.  If a Namespace is present in the
   REF-AS-ELEMENT encoding instruction, then an attribute item with the
   [local name] "namespace" SHALL be added to the [attributes] of the
   <element> or <component> element item.  The [normalized value] of
   this attribute item is the string value of the AnyURIValue in the
   Namespace.

   If a ContextParameter is present in the RefParameters in the
   ATTRIBUTE-REF, ELEMENT-REF, or REF-AS-ELEMENT encoding instruction,
   then an attribute item with the [local name] "context" SHALL be added
   to the [attributes] of the <attribute>, <element>, or <component>
   element item.  The [normalized value] of this attribute item is the
   string value of the AnyURIValue in the ContextParameter.

   If a NamedType is subject to both an ATTRIBUTE encoding instruction
   and a VERSION-INDICATOR encoding instruction, then an attribute item
   with the [local name] "versionIndicator" and [normalized value]
   "true" or "1" SHALL be added to the <attribute> element item.  If a
   NamedType is subject to an ATTRIBUTE encoding instruction and not
   subject to a VERSION-INDICATOR encoding instruction, then an
   attribute item with the [local name] "versionIndicator" and
   [normalized value] "false" or "0" MAY be added to the <attribute>
   element item.

   If a NamedType is not subject to an ATTRIBUTE-REF, COMPONENT-REF,
   ELEMENT-REF, or REF-AS-ELEMENT encoding instruction, then the
   translation of the Type in the NamedType SHALL be added to the
   [children] or [attributes] of the <attribute>, <element>,
   <component>, <group>, <item>, <member>, or <simpleContent> element
   item.
Top   ToC   RFC4912 - Page 36
   If a NamedType is subject to an ATTRIBUTE-REF, COMPONENT-REF,
   ELEMENT-REF, or REF-AS-ELEMENT encoding instruction, then the
   translation of each EncodingPrefix (Section 6.7) and Tag
   (Section 6.7.2) textually within the NamedType SHALL be added in
   order to the [children] of the <attribute>, <element>, or <component>
   element item.

   Example

      CHOICE {
          one    INTEGER,
          two    [RXER:ATTRIBUTE] BOOLEAN,
          three  [RXER:ATTRIBUTE-REF
                     { namespace-name "http://www.example.com/schema",
                       local-name "foo" }]
                 UTF8String,
          bar    [RXER:ELEMENT-REF
                     { namespace-name "http://www.example.com/schema",
                       local-name "bar" }]
                 Markup,
          five   [0] [RXER:REF-AS-ELEMENT "product"
                     CONTEXT "http://www.example.com/inventory"]
                 Markup,
          six    [RXER:GROUP] MySequence
      }

      <type>
       <choice xmlns:ex="http://www.example.com/schema">
        <element name="one" type="asnx:INTEGER"/>
        <attribute name="two" type="asnx:BOOLEAN"/>
        <attribute ref="ex:foo" identifier="three" embedded="true"/>
        <element ref="ex:bar" embedded="true"/>
        <element elementType="product"
                 context="http://www.example.com/inventory"
                 identifier="five">
         <TAG number="0"/>
        </element>
        <group name="six" type="tns:MySequence"/>
       </choice>
      </type>

6.12.2. SequenceType Translation

The translation of a SequenceType is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "sequence" SHALL be appended to the [children] of the <type> element item. The
Top   ToC   RFC4912 - Page 37
   translation of each ComponentType nested in the ComponentTypeList in
   the initial RootComponentTypeList, if present, SHALL be appended to
   the [children] of the <sequence> element item.

   If an ExtensionAndException is present, then an element item with the
   [local name] "extension" SHALL be appended to the [children] of the
   <sequence> element item.  If an ExceptionSpec is present in the
   ExtensionAndException, then the translation of the ExceptionSpec
   (possibly empty) SHALL be added to the [children] of the <extension>
   element item.

   If an ExtensionAdditions instance is present, then the translation of
   each ExtensionAdditionGroup or ComponentType nested in the
   ExtensionAdditions (if any) SHALL be appended to the [children] of
   the <extension> element item.

   If an ExtensionEndMarker is present, then the translation of each
   ComponentType nested in the ComponentTypeList in the final
   RootComponentTypeList SHALL be appended to the [children] of the
   <sequence> element item.

   The translation of an ExtensionAdditionGroup is an element item with
   the [local name] "extensionGroup".  If the VersionNumber in the
   ExtensionAdditionGroup is not empty, then an attribute item with the
   [local name] "version" SHALL be added to the [attributes] of the
   <extensionGroup> element item.  The [normalized value] of this
   attribute item is the number in the VersionNumber.  The translation
   of each ComponentType nested in the ExtensionAdditionGroup SHALL be
   appended to the [children] of the <extensionGroup> element item.

   The translation of a ComponentType of the "NamedType" form is the
   normal translation of the NamedType.

   The translation of a ComponentType of the "NamedType OPTIONAL" form
   is an element item with the [local name] "optional".  The normal
   translation of the NamedType SHALL be added to the [children] of the
   <optional> element item.

   The translation of a ComponentType of the "NamedType DEFAULT Value"
   form is an element item with the [local name] "optional".  The normal
   translation of the NamedType SHALL be added to the [children] of the
   <optional> element item.  An element item with the [local name]
   "default" SHALL be appended to the [children] of the <optional>
   element item.  The translation of the Value SHALL be added to the
   [children] or [attributes] of the <default> element item.
Top   ToC   RFC4912 - Page 38
   The translation of a ComponentType of the "COMPONENTS OF Type" form
   is an element item with the [local name] "componentsOf".  The
   translation of the Type SHALL be added to the [children] or
   [attributes] of the <componentsOf> element item.

   Example

      SEQUENCE {
          one    INTEGER,
          two    [RXER:ATTRIBUTE] BOOLEAN OPTIONAL,
          ...,
          [[ 2:
              four   NULL
          ]],
          COMPONENTS OF MySequence,
          ...,
          three   PrintableString DEFAULT "third"
      }

      <type>
       <sequence>
        <element name="one" type="asnx:INTEGER"/>
        <optional>
         <attribute name="two" type="asnx:BOOLEAN"/>
        </optional>
        <extension>
         <extensionGroup version="2">
          <element name="four" type="asnx:NULL"/>
         </extensionGroup>
         <componentsOf type="tns:MySequence"/>
        </extension>
        <optional>
         <element name="three" type="asnx:PrintableString"/>
         <default literalValue="third"/>
        </optional>
       </sequence>
      </type>

6.12.3. SetType Translation

The translation of a SetType follows the same procedure as the translation of a SequenceType except that SetType replaces SequenceType, "SET" replaces "SEQUENCE", and the [local name] "set" is used instead of "sequence".
Top   ToC   RFC4912 - Page 39

6.12.4. ChoiceType Translation

The translation of a ChoiceType that is not subject to a UNION encoding instruction is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "choice" SHALL be appended to the [children] of the <type> element item. The normal translation of each NamedType nested in the AlternativeTypeList in the RootAlternativeTypeList in the AlternativeTypeLists SHALL be appended to the [children] of the <choice> element item. If an ExtensionAndException is present in the AlternativeTypeLists, then an element item with the [local name] "extension" SHALL be appended to the [children] of the <choice> element item. If an ExceptionSpec is present in the ExtensionAndException, then the translation of the ExceptionSpec (possibly empty) is added to the [children] of the <extension> element item. If an ExtensionAdditionAlternatives instance is present in the AlternativeTypeLists, then the translation of each ExtensionAdditionAlternativesGroup or NamedType (if any) nested in the ExtensionAdditionAlternatives SHALL be appended in order to the [children] of the <extension> element item. The normal translation of the NamedType is used. The translation of an ExtensionAdditionAlternativesGroup is an element item with the [local name] "extensionGroup". If the VersionNumber in the ExtensionAdditionAlternativesGroup is not empty, then an attribute item with the [local name] "version" SHALL be added to the [attributes] of the <extensionGroup> element item. The [normalized value] of this attribute item is the number in the VersionNumber. The normal translation of each NamedType nested in the AlternativeTypeList in the ExtensionAdditionAlternativesGroup SHALL be appended to the [children] of the <extensionGroup> element item.
Top   ToC   RFC4912 - Page 40
   Example

      CHOICE {
          one  INTEGER,
          two  [RXER:NAME AS "Two"] BOOLEAN,
          ...,
          [[ 2:
              three  NULL
          ]],
          four  PrintableString,
          ...
      }

      <type>
       <choice>
        <element name="one" type="asnx:INTEGER"/>
        <element name="Two" type="asnx:BOOLEAN"/>
        <extension>
         <extensionGroup version="2">
          <element name="three" type="asnx:NULL"/>
         </extensionGroup>
         <element name="four" type="asnx:PrintableString"/>
        </extension>
       </choice>
      </type>

6.12.5. Translation of UNION Types

The translation of a ChoiceType that is subject to a UNION encoding instruction follows the same procedure as the translation of a ChoiceType that is not subject to a UNION encoding instruction except that the [local name] "union" is used instead of "choice", and the member translation of each NamedType is used instead of the normal translation. In addition, if the UNION encoding instruction has a PrecedenceList, then an attribute item with the [local name] "precedence" SHALL be added to the [attributes] of the <union> element item. The [normalized value] of this attribute item is the white space separated list of qualified names for the expanded names of the NamedType instances [RXEREI] corresponding to the identifiers in the PrecedenceList. A white space separator is one or more of the white space characters.
Top   ToC   RFC4912 - Page 41
   Example

      [RXER:UNION PRECEDENCE utf8 visible] CHOICE {
          printable  PrintableString,
          teletex    TeletexString,
          visible    [RXER:NAME AS "ascii"] VisibleString,
          ...,
          utf8       UTF8String
      }

      <type>
       <union precedence="utf8 ascii">
        <member name="printable" type="asnx:PrintableString"/>
        <member name="teletex" type="asnx:TeletexString"/>
        <member name="ascii" identifier="visible"
                type="asnx:VisibleString"/>
        <extension>
         <member name="utf8" type="asnx:UTF8String"/>
        </extension>
       </union>
      </type>

6.12.6. SequenceOfType Translation

The translation of a SequenceOfType that is not subject to a LIST encoding instruction is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "sequenceOf" SHALL be appended to the [children] of the <type> element item. If the SequenceOfType is of the "SEQUENCE OF NamedType" form, then the normal translation of the NamedType SHALL be added to the [children] of the <sequenceOf> element item. If the SequenceOfType is of the "SEQUENCE OF Type" form, then an element item with the [local name] "element" or "component" (translator's choice) SHALL be added to the [children] of the <sequenceOf> element item. An attribute item with the [local name] "name" and [normalized value] "item" SHALL be added to the [attributes] of the <element> or <component> element item. An attribute item with the [local name] "identifier" and empty [normalized value] SHALL be added to the [attributes] of the <element> or <component> element item. The translation of the Type SHALL be added to the [children] or [attributes] of the <element> or <component> element item.
Top   ToC   RFC4912 - Page 42
   Examples

      SEQUENCE OF INTEGER

      <type>
       <sequenceOf>
        <element name="item" identifier="" type="asnx:INTEGER"/>
       </sequenceOf>
      </type>

      SEQUENCE OF counter INTEGER

      <type>
       <sequenceOf>
        <element name="counter" type="asnx:INTEGER"/>
       </sequenceOf>
      </type>

6.12.7. Translation of LIST Types

The translation of a SequenceOfType that is subject to a LIST encoding instruction is an element item with the [local name] "type". An element item with the [local name] "annotation" MAY be added to the [children] of the <type> element item. An element item with the [local name] "list" SHALL be appended to the [children] of the <type> element item. The item translation of the NamedType in the SequenceOfType SHALL be added to the [children] of the <list> element item. Aside: A SequenceOfType is necessarily of the "SEQUENCE OF NamedType" form for a LIST encoding instruction. Example [RXER:LIST] SEQUENCE OF number INTEGER <type> <list> <item name="number" type="asnx:INTEGER"/> </list> </type>

6.12.8. SetOfType Translation

The translation of a SetOfType follows the same procedure as the translation of a SequenceOfType except that SetOfType replaces SequenceOfType, "SET" replaces "SEQUENCE", and the [local name] "setOf" is used instead of "sequenceOf".
Top   ToC   RFC4912 - Page 43

6.12.9. Effect of Insertion Encoding Instructions

If a Type is subject to a NO-INSERTIONS, HOLLOW-INSERTIONS, SINGULAR-INSERTIONS, UNIFORM-INSERTIONS, or MULTIFORM-INSERTIONS encoding instruction, then an attribute item with the [local name] "insertions" SHALL be added to the [attributes] of the <choice>, <sequence> or <set> element item in the [children] of the <type> element item resulting from the translation of the Type. The [normalized value] of this attribute item is "none" in the case of a NO-INSERTIONS encoding instruction, "hollow" in the case of a HOLLOW-INSERTIONS encoding instruction, "singular" in the case of a SINGULAR-INSERTIONS encoding instruction, "uniform" in the case of a UNIFORM-INSERTIONS encoding instruction, and "multiform" in the case of a MULTIFORM-INSERTIONS encoding instruction. Example [NO-INSERTIONS] CHOICE { one [RXER:GROUP] [RXER:SINGULAR-INSERTIONS] CHOICE { two INTEGER, ... }, ... } <type> <choice insertions="none"> <group name="one"> <type> <choice insertions="singular"> <element name="two" type="asnx:INTEGER"/> <extension/> </choice> </type> </group> <extension/> </choice> </type>


(page 43 continued on part 3)

Next Section