The ASN.1 ENUMERATED type is converted into an XSD token type with enumeration items. The enumeration items correspond to the enumerated identifiers in the type.
If the -attrs enum command-line option is specified and the enumerated items contain numbers (i.e do not follow the standards sequence), then an asn1:value attribute is added to the type to allow an application to map the enumerated identifiers to numbers. If an asn1:value attribute is not present, then an application can safely assume that the enumerated identifiers are in sequential order starting at zero.
ASN.1 production:
TypeName ::= ENUMERATED (id1(val1), id2(val2), etc.)
Generated XSD code:
<xsd:simpleType name="TypeName"> <xsd:restriction base="xsd:token"> <xsd:enumeration name="id1" asn1:value="val1"> <xsd:enumeration name="id2" asn1:value="val2"> </xsd:restriction> </xsd:simpleType>
The asn1:value attributes added to the enumeration items above are an example of non-native attributes. These are attributes that are not defined within the XML Schema standard but that may be added to provide additional information about an element contained within the schema. Conformant XML schema processors should ignore these attributes. They are only added to the generated code if the -attrs enum option is added to the ASN1C command-line (or -attrs option with no qualifiers)
It is also possible to generate an "application information" (appinfo) section within the generated schema containing information on the enumerated values. This is done using the -appinfo enum option (or -appinfo with no qualifiers). The generated code with <appinfo> would be as follows:
<xsd:simpleType name="TypeName"> <xsd:annotation> <xsd:appinfo> <asn1:EnumInfo> <asn1:EnumItem name="id1" value="val1"/> <asn1:EnumItem name="id2" value="val2"/> </asn1:EnumInfo> </xsd:appinfo> </xsd:annotation> <xsd:restriction base="xsd:token"> <xsd:enumeration name="id1"> <xsd:enumeration name="id2"> </xsd:restriction> </xsd:simpleType>