Recommendation ITU-T X.693 International Standard 8825-4
Recommendation ITU-T X.693 International Standard 8825-4
693
International Standard 8825-4
Information technology –
ASN.1 encoding rules:
XML Encoding Rules (XER)
INTERNATIONAL STANDARD ISO/IEC 8825-4
RECOMMENDATION ITU-T X.693
Information technology –
ASN.1 encoding rules:
XML Encoding Rules (XER)
Summary
Recommendation ITU-T X.693 | ISO/IEC 8825-4 specifies rules for encoding values of ASN.1 types using the
Extensible Markup Language (XML).
Source
Recommendation ITU-T X.693 was prepared by ITU- T Study Group 17 ((2017-2020) and approved on 13 February
2021. An identical text is also published as ISO/IEC 8825-4.
7 CONFORMANCE ......................................................................................................................................... 5
12 KEYWORDS ................................................................................................................................................. 14
Rec. ITU-T X.680 | ISO/IEC 8824-1, Rec. ITU-T X.681 | ISO/IEC 8824-2, Rec. ITU-T X.682 | ISO/IEC 8824-3, Rec.
ITU-T X.683 | ISO/IEC 8824-4 together describe Abstract Syntax Notation One (ASN.1), a notation for the definition
of messages to be exchanged between peer applications.
This Recommendation | International Standard defines encoding rules that may be applied to values of ASN.1 types
defined using the notation specified in Rec. ITU-T X.680 | ISO/IEC 8824-1 and Rec. ITU-T X.681 | ISO/IEC 8824-2.
Application of these encoding rules produces a transfer syntax for such values. It is implicit in the specification of these
encoding rules that they are also to be used for decoding.
There is more than one set of encoding rules that can be applied to values of ASN.1 types. This Recommendation |
International Standard defines three sets of encoding rules that use the Extensible Markup Language (XML). These
encoding rules all produce an XML document compliant to W3C XML 1.0. The first set is called the Basic XML
Encoding Rules (BASIC-XER). The second set is called the Canonical XML Encoding Rules (CANONICAL-XER, or
CXER) because there is only one way of encoding an ASN.1 value using these encoding rules. (Canonical encoding
rules are generally used for applications using security-related features such as digital signatures.) The third set is
called the extended XML Encoding Rules (EXTENDED-XER). The extended XML Encoding Rules allow additional
encoders options, and take account of encoding instructions that specify variations of the BASIC-XER encodings in
order to support specific styles of XML documents (see below). The extended XML Encoding Rules are not canonical,
and there is no canonical form for these rules defined in this Recommendation | International Standard.
There are many aspects of an XML representation of data (such as the use of XML attributes instead of child elements,
or the use of white-space delimited lists) whose use is a matter of style and XML designer choice. If a type defined in
an ASN.1 specification is encoded by BASIC-XER or by CXER, then there is a single fixed style used for the XML
representation, with no user control of stylistic features. This Recommendation | International Standard specifies the
syntax and semantics of XER encoding instructions which specify the stylistic features of the XML in an EXTENDED-
XER encoding. XER encoding instructions can also be used to determine the possible insertion of XML processing
instructions in an EXTENDED-XER encoding. XER encoding instructions are ignored by BASIC-XER and by CXER,
but are used by EXTENDED-XER.
NOTE – "Stylistic features", such as use of attributes or white-space delimited lists, can also affect the size of an encoding and
the ease with which it can be processed, so use of such features is not just a matter of style. Where such issues are important,
EXTENDED-XER with encoding instructions may be preferred over BASIC-XER or CXER.
INTERNATIONAL STANDARD
ITU-T RECOMMENDATION
Information technology –
ASN.1 encoding rules:
XML Encoding Rules (XER)
1 Scope
This Recommendation | International Standard specifies a set of basic XML Encoding Rules (BASIC-XER) that may be
used to derive a transfer syntax for values of types defined in Rec. ITU-T X.680 | ISO/IEC 8824-1 and Rec. ITU-T
X.681 | ISO/IEC 8824-2. This Recommendation | International Standard also specifies a set of Canonical XML
Encoding Rules (CXER) which provide constraints on the basic XML Encoding Rules and produce a unique encoding
for any given ASN.1 value. This Recommendation | International Standard further specifies a set of extended XML
Encoding Rules (EXTENDED-XER) which adds further encoders options, and also allows the ASN.1 specifier to vary
the encoding that would be produced by BASIC-XER. It is implicit in the specification of these encoding rules that
they are also used for decoding.
The encoding rules specified in this Recommendation | International Standard:
– are used at the time of communication;
– are intended for use in circumstances where displaying of values and/or processing them using
commonly available XML tools (such as browsers) is the major concern in the choice of encoding rules;
– allow the extension of an abstract syntax by addition of extra values for all forms of extensibility
described in Rec. ITU-T X.680 | ISO/IEC 8824- 1.
This Recommendation | International Standard also specifies the syntax and semantics of XER encoding instructions,
and the rules for their assignment and combination. XER encoding instructions can be used to control the EXTENDED-
XER encoding for specific ASN.1 types.
2 Normative references
The following Recommendations and International Standards contain provisions which, through reference in this text,
constitute provisions of this Recommendation | International Standard. At the time of publication, the editions indicated
were valid. All Recommendations and Standards are subject to revision, and parties to agreements based on this
Recommendation | International Standard are encouraged to investigate the possibility of applying the most recent
edition of the Recommendations and Standards listed below. Members of IEC and ISO maintain registers of currently
valid International Standards. The Telecommunication Standardization Bureau of the ITU maintains a list of currently
valid ITU-T Recommendations.
NOTE – This Recommendation | International Standard is based on ISO/IEC 10646:2003 and the Unicode standard version
3.2.0:2002. It cannot be applied using later versions of these two standards.
3 Definitions
For the purposes of this Recommendation | International Standard, the definitions of Rec. ITU-T X.680 | ISO/IEC
8824- 1 and the following definitions apply.
3.2.2 associated empty-element tag: The XML empty-element tag that can replace an associated preceding tag and
an associated following tag, when present.
NOTE – Some encoding instructions remove the associated tags of an "XMLValue".
3.2.3 associated encoding instructions (for a type): A set of XER encoding instructions associated with a type.
3.2.4 associated following tag: The XML end-tag following the "XMLValue" of a type in the absence of encoding
instructions that remove the associated tags.
3.2.5 associated preceding tag: The XML start-tag preceding the "XMLValue" of a type in the absence of
encoding instructions that remove the associated tags.
3.2.6 canonical encoding: A complete encoding of an abstract value obtained by the application of encoding rules
that have no implementation-dependent options. Such rules result in the definition of a 1- 1 mapping between
unambiguous and unique encodings and values in the abstract syntax.
3.2.7 canonical valid XML document (for an ASN.1 schema): An XML document which is well-formed (see
W3C XML 1.0) and whose content conforms to the CXER specification for the encoding of an ASN.1 type specified by
an ASN.1 schema.
3.2.8 character-encodable type: An ASN.1 type to which an ATTRIBUTE encoding instruction can be applied
(see 20.2.1).
3.2.9 control namespace: A namespace that is used to identify attributes that perform functions or carry values that
control an EXTENDED-XER encoding.
NOTE 1 – An example would be a type identification attribute. The control namespace defaults to the ASN.1 namespace
specified in 16.9, but can be changed by the GLOBAL-DEFAULTS encoding instruction.
NOTE 2 – The control namespace may also contain names for attributes that may be present, but which are ignored by
EXTENDED-XER decoders (see 10.2.10). An example of such an attribute name could be schemaLocation.
3.2.10 enclosed (ASN.1) type: An ASN.1 type whose "XMLValue" in a BASIC-XER encoding is enclosed directly
within the "XMLValue" of an ASN.1 type (the enclosing type).
NOTE – All types in a BASIC-XER or EXTENDED-XER encoding are enclosed types unless they are used as the root type (see
10.3.1 b) in an encoding.
3.2.13 final encoding instructions (for a type): The set of XER encoding instructions associated with a type as a
result of the complete ASN.1 specification, and which are applied in producing encodings of that type.
3.2.14 inherited encoding instructions: XER encoding instructions that are associated with the type identified by a
type reference.
3.2.15 namespace-qualified name: A name in an XML document that has an XML namespace prefix or is an XML
element name in the scope of an XML default namespace declaration.
NOTE – XML default namespace declarations affect only XML element names, not the names of attributes. A namespace prefix
can be applied to either.
3.2.16 nil identification attribute: An XML attribute that can appear on any element to identify whether the content
has a nil value (see clause 33).
3.2.17 partial XML element content: XML child elements defined by an ASN.1 type which is UNTAGGED, and
which provides part of the XML element content generated by the enclosing type.
NOTE – If the enclosing type is itself UNTAGGED, then that enclosing type may also be generating only partial XML element
content.
3.2.18 prefixed encoding instructions: XER encoding instructions that are assigned using a type prefix.
NOTE – Prefixed encoding instructions can delete, replace, or add to the associated encoding instructions of a type.
3.2.19 qualifying information: Information supplied as part of the specification of a target for the assignment of an
encoding instruction that identifies specific values of the target type.
3.2.20 targeted encoding instructions: XER encoding instructions that are assigned using a target list in an XER
encoding control section.
NOTE – Targeted encoding instructions can delete, replace, or add to the associated encoding instructions of a type.
3.2.21 type identification attribute: An XML attribute that can appear on any element to identify the type of that
element (see clause 37).
3.2.22 uniform resource identifier (URI): A globally unambiguous identifier, assigned according to any one of a
number of URI schemes, used to provide identification of namespaces in EXTENDED-XER encodings.
NOTE – The URI scheme used by default for ASN.1 enables an ASN.1 object identifier value to be used to identify namespaces
(see 16.9 and 29.1.5).
3.2.23 valid XML document (for an ASN.1 schema): An XML document which is well-formed (see W3C XML
1.0) and whose content conforms to the BASIC-XER, CXER or EXTENDED-XER specification for the encoding of an
ASN.1 type specified by an ASN.1 schema, possibly including XER encoding instructions.
3.2.24 XER encoding instructions: Notation used to change the EXTENDED-XER encoding of a type (or of a
component of a type).
NOTE – XER encoding instructions are included in either an XER type prefix (see Rec. ITU-T X.680 | ISO/IEC 8824- 1, 31.3) or
an XER encoding control section (see Rec. ITU-T X.680 | ISO/IEC 8824- 1, clause 54).
3.2.25 XML attribute: Part of an EXTENDED-XER encoding consisting of an "XMLValue" enclosed in quotation
marks or apostrophes, preceded by an (attribute) name and an equals sign.
3.2.26 XML element: Part of an XML document specified in W3C XML 1.0.
NOTE – An XML element is either an empty-element tag or starts with a start-tag and ends with an end-tag. Both the start-tag
and the empty-element tag can contain attribute encodings.
3.2.27 XML element name: The lexical item following a "<" or "</" lexical item in the associated tags.
3.2.28 XML document: A sequence of characters which conforms to the W3C XML 1.0 definition of document.
3.2.29 XML processing instruction: Part of an XML document which carries information concerning the
processing of some or all of that document (see W3C XML 1.0).
NOTE – The processing instruction identifies the type of processing for which it is applicable, and is ignored in other processing.
It could be used to identify a style-sheet that is to be applied if the document is presented for human viewing.
3.2.30 XML prolog: The initial part of an XML document (which does not carry information about the value of the
ASN.1 type that has been encoded).
4 Abbreviations
For the purposes of this Recommendation | International Standard, the following abbreviations apply:
ASN.1 Abstract Syntax Notation One
CXER Canonical XML Encoding Rules
PDU Protocol Data Unit
UCS Universal Multiple-Octet Coded Character Set
URI Uniform Resource Identifier
UTC Coordinated Universal Time
UTF-8 UCS Transformation Format, 8-bit form
XER XML Encoding Rules
XML Extensible Markup Language
NOTE 1 – Any implementation conforming to CXER for encoding is conformant to BASIC-XER for encoding. Any
implementation conforming to BASIC-XER for decoding is conformant to CXER for decoding. Thus, encodings made according
to CXER are encodings that are permitted by BASIC-XER.
NOTE 2 – CXER produces encodings that have applications when authenticators need to be applied to abstract values.
5.4 The third set of encoding rules specified in this Recommendation | International Standard is EXTENDED-
XER. This is defined as variations of the BASIC-XER encodings specified by XER encoding instructions (see 6)
associated with an ASN.1 type. In the absence of XER encoding instructions, an EXTENDED-XER encoding differs
from a BASIC-XER encoding only because it provides more encoders options.
5.5 If a type encoded with CXER contains EMBEDDED PDV, EXTERNAL or CHARACTER STRING types, then the
outer encoding ceases to be canonical unless the encoding used for all the EMBEDDED PDV, EXTERNAL and CHARACTER
STRING types is canonical.
7 Conformance
7.1 Dynamic conformance for the basic XML Encoding Rules is specified by clause 8, and dynamic conformance
for the Canonical XML Encoding Rules is specified by clause 9, and dynamic conformance for the extended XML
Encoding Rules is specified by clause 10.
7.2 Static conformance is specified by those standards which specify the application of one or more of these
encoding rules.
7.3 Alternative encodings are permitted by the basic XML Encoding Rules and by the extended XML Encoding
Rules as an encoder's option. Decoders that claim conformance to BASIC-XER shall support all BASIC-XER
alternatives. Decoders that claim conformance to EXTENDED-XER shall support all EXTENDED-XER encoding
alternatives.
NOTE – This clause applies whether or not there are any final encoding instructions.
7.4 No alternative encodings are permitted by the Canonical XML Encoding Rules for the encoding of an ASN.1
value.
8.1.3 The XML document shall be encoded using UTF-8 to produce a string of octets which forms the encoding
specified in this Recommendation | International Standard. The ASN.1 object identifier for these encoding rules is
specified in clause 40.
8.1.4 Where this Recommendation | International Standard uses the term "white-space", this means one or more of
the following characters of the Unicode Standard: HORIZONTAL TABULATION (9), LINE FEED (10), CARRIAGE
RETURN (13), SPACE (32). The numbers in parentheses are the decimal value of the characters of the Unicode
Standard. The number and choice of characters that constitutes "white-space" is an encoder's option.
8.1.5 Where this Recommendation | International Standard uses the term "white-space with escapes", this means
one or more of the characters listed in 8.1.4, with an encoder's option to represent any of these characters with an escape
sequence of the form "&#n
&#n;" or "&#xn
&#xn;" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.15.8).
8.4.2 Rec. ITU-T X.691 | ISO/IEC 8825-2, 29.5 to 29.8 shall apply, except that the provisions of 29.6 shall be
replaced by 8.4.3 of this Recommendation | International Standard.
8.4.3 If the data value is the value of a single ASN.1 type, and if the encoding rules for this data value are those
specified in this (XER) Recommendation | International Standard, then the sending implementation shall use the
"single- ASN1- type" alternative.
8.4.4 Rec. ITU-T X.691 | ISO/IEC 8825-2, 29.9 to 29.11 shall apply, except that the provisions of 29.9 shall be
replaced by 8.4.5 of this Recommendation | International Standard. The Note in Rec. ITU-T X.691 | ISO/IEC 8825-2,
29.9 applies.
8.4.5 If the "encoding" choice is "single-ASN1-type", then the ASN.1 type shall be the "XMLTypedValue" of the
type encoded in the "EXTERNAL", with a value equal to the data value to be encoded.
8.6.3 Unknown extensions in a choice type result in a single unexpected XML element in place of an element
corresponding to one of the known choices. It will always have a different XML element name from that of any XML
element that encodes a known alternative of the choice type.
8.6.4 Unknown extensions in an enumerated type result in an XML element with an unexpected content, but with
no unexpected XML elements.
8.6.5 Unknown extensions arising from relaxation of a subtype constraint result in an encoding that can be a valid
encoding of any value of the unconstrained type. Such encodings can produce unexpected content, but no unexpected
XML elements.
9.1.3 The escape sequences specified in Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.15.8, shall not be used.
9.1.4 If the XML value notation permits the use of an XML empty-element tag (see Rec. ITU-T X.680 |
ISO/IEC 8824-1, 16.5 and 17.8), then this empty-element tag shall be used.
9.2.5 No "+" sign shall be present either before the integer part or before the exponent.
9.7.3 A conceptual "pad" character is used in specifying the sort order. This character precedes all other characters.
When determining whether a string "A" sorts before a string "B", the shorter string has conceptual "pad" characters
added at its end if necessary. String "A" sorts before string "B" if and only if the character in string "A" precedes the
corresponding character in string "B" in the first character position in which they have different characters.
9.10 GeneralizedTime
9.10.1 The encoding of a value of type "GeneralizedTime" shall terminate with the character "Z" (see Rec. ITU-T
X.680 | ISO/IEC 8824-1, 46.3).
9.10.2 The string representing the seconds shall always be present.
9.10.3 The string representing fractions of seconds, if present, shall omit all trailing zeros. If the fractional part
corresponds to 0, this string shall be wholly omitted together with the decimal point.
EXAMPLE
Seconds represented with the string "26.000" shall be encoded as "26". Seconds represented with the string "26.5200"
shall be encoded as "26.52".
9.10.4 The decimal point, if present, shall be ".".
9.10.5 Midnight (GMT) shall be encoded as a string of the form:
"YYYYMMDD000000Z"
where "YYYYMMDD" represents the day following the midnight in question.
EXAMPLE
The followings encodings are valid:
"19920521000000Z"
"19920622123421Z"
"19920722132100.3Z"
The following encodings are invalid:
"19920520240000Z" (midnight represented incorrectly)
"19920622123421.0Z" (spurious trailing zeros)
"19920722132100.30Z" (spurious trailing zeros)
9.11 UTCTime
9.11.1 The encoding of a value of type "UTCTime" shall terminate with the character "Z" (see Rec. ITU-T X.680 |
ISO/IEC 8824-1, 47.3).
9.11.2 The string representing the seconds shall always be present.
9.11.3 Midnight (GMT) shall be encoded as a string of the form:
"YYMMDD000000Z"
where "YYMMDD" represents the day following the midnight in question.
EXAMPLE
The following encodings are valid:
"920521000000Z"
"920622123421Z"
"920722132100Z"
10.1 General
10.1.1 The extended XML encoding rules (EXTENDED-XER) augment and modify BASIC-XER. They enable
ASN.1 to define the form and content of a much wider range of XML documents.
10.1.2 EXTENDED-XER extends BASIC-XER in three main ways.
a) It provides additional encoder's options (for example, for the insertion of XML Processing Instructions or
XML Comment, and for the use of identifiers for named bits in a bitstring value);
b) It specifies a set of encoding instructions that can be used to specify modification of the BASIC-XER
encoding of an ASN.1 type, including an encoding instruction to use simple text rather than empty-
element tags for boolean, integer (with named numbers), enumerated, special values of real, and bitstring
(with named bits) types;
c) It requires decoders to ignore (in the absence of encoding instructions) attributes from the control
namespace that are unknown (for example, a schemaLocation attribute), and some known attributes that
other XML tools may insert which may have different values from those that a conforming encoder can
insert (for example, use of a type identification attribute). (See 10.2.10.)
10.1.3 If an ASN.1 specification does not contain any XER encoding instructions, then every BASIC-XER encoding
of any abstract value of an ASN.1 type is also an EXTENDED-XER encoding of the same abstract value of that type.
NOTE – The opposite is not true. Even in the absence of XER encoding instructions, there are EXTENDED-XER encodings that
are not conforming to BASIC-XER encodings (see 10.1.2 a and 10.1.2 c).
10.1.4 All occurrences of ASN.1 "Type" notation have an associated set (possibly empty) of XER encoding
instructions (the final associated encoding instructions). Encoding instructions are associated with a "Type" through:
a) (Inherited encoding instructions) the presence of associated encoding instructions on the "Type" used in
the definition of a "typereference" used as a "Type"; and
b) (Targeted encoding instruction) assignment of one or more XER encoding instructions to an occurrence
of "Type" using an XER encoding control section (see Rec. ITU-T X.680 | ISO/IEC 8824- 1, clause 54);
and
NOTE – An ASN.1 module can contain only one XER encoding control section, and hence only one XER
"EncodingInstructionAssignmentList" (see Rec. ITU-T X.680 | ISO/IEC 8824- 1, 54.2)
c) (Prefixed encoding instructions) assignment of one or more XER encoding instructions to an occurrence
of "Type" using XER type prefixes (see Rec. ITU-T X.680 | ISO/IEC 8824- 1, 31.3); and
d) (Import-list encoding instructions) assignment of one or more encoding instructions to all type references
imported from an identified ASN.1 module.
10.1.5 The effect of assigning an XER encoding instruction is to add, delete, or replace associated encoding
instructions (see clause 15 for the rules that apply for multiple assignments of XER encoding instructions).
10.1.6 The order (or manner) in which encoding instructions become part of (or are removed from) the set of
associated encoding instructions is not significant in the application of the final encoding instructions.
10.1.7 The final encoding instructions affect the EXTENDED-XER encoding of types. They have no other impact,
and in particular are not associated with any value reference defined using the type, nor do they affect value mappings,
nor do they affect other encoding rules.
NOTE – There are, however, requirements on the unambiguity of names that are affected by the presence of a final NAME,
NAMESPACE, or UNTAGGED encoding instruction. These requirements can be interpreted either as restrictions on the way in which
types with such final encoding instructions can be used, or as restrictions on the use of these encoding instructions.
10.2.2 A conforming EXTENDED-XER encoding of an ASN.1 type with no final encoding instructions shall be the
encoding produced by the basic XML encoding rules (BASIC-XER) specified in clause 8, with the additional encoder's
options specified in 10.2.5 and 10.2.6.
NOTE – EXTENDED-XER decoders are required by 10.2.4 to accept and process W3C XML document type declarations, but
these are not generated by conforming encoders, and do not form part of EXTENDED-XER encodings.
10.2.3 The EXTENDED-XER encoding of an ASN.1 type with final encoding instructions, or with components (at
any depth, and after resolving all type references) that have associated encoding instructions, shall be the encoding
specified in clause 17.
NOTE – The final encoding instructions are applied in an EXTENDED-XER encoding, and are also used by decoders and
validators of EXTENDED-XER encodings.
10.2.4 EXTENDED-XER decoders (whether MODIFIED-ENCODINGS was used or not – see clause 26) shall process
any document type declaration (see W3C XML 1.0, 2.8) that is present, in accordance with the requirements for non-
validating XML processors (see W3C XML 1.0, 5.1). This processing shall be performed (conceptually) before
applying all other decoding requirements in this Recommendation | International Standard. EXTENDED- XER
encoders shall not include a document type declaration.
10.2.5 An EXTENDED-XER encoder can (as an encoder's option) insert XML Processing Instructions or XML
Comment (in addition to any that might be required by clause 30) in the XML document element or XML prolog in any
position permitted by W3C XML 1.0. The syntactic form and semantics of XML Processing Instructions is specified in
W3C XML 1.0, 2.6. The syntactic form and semantics of XML Comment is specified in W3C XML 1.0, 2.5.
10.2.6 If there is no GLOBAL-DEFAULTS encoding instruction with a MODIFIED-ENCODINGS keyword (see clause 26)
in the XER encoding control section, then:
a) the "XMLIntegerValue" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 19.9) may be either
"XMLSignedNumber" or "EmptyElementInteger", as an encoder's option; and
b) the "XMLBitStringValue" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 22.9) may be any of the alternatives
of this production, as an encoder's option. If the "XMLIdentifierList" is used, it shall be the
"EmptyElementList".
10.2.7 If there is a GLOBAL-DEFAULTS encoding instruction with a MODIFIED-ENCODINGS keyword (see clause 26)
in the XER encoding control section, then:
a) the "XMLBooleanValue" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 18.3) shall be "TextBoolean"; and
b) the "ExtendedXMLIntegerValue" (see 17.4) shall be the "ModifiedXMLIntegerValue" alternative,
defined in 17.8; and
NOTE 1 – This allows the use of a text value for "NamedNumber"s of an integer type, as an encoder's option,
but also modifies the syntax for numeric encodings of an integer value.
c) the "ExtendedXMLEnumeratedValue" (see 34.3) shall not be "EmptyElementEnumerated"; and
NOTE 2 – In the absence of a GLOBAL-DEFAULTS of MODIFIED-ENCODINGS, it cannot be "TextEnumerated"
(see 8.3.7 and 34.3).
d) the "ExtendedXMLRealValue" (see 17.4) shall be the "ModifiedXMLRealValue" alternative, defined in
17.9; and
e) the "XMLSpecialRealValue" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 21.6) shall be the "TextReal"
alternative; and
f) the alternative of "XMLIdentifierList" in the "XMLBitStringValue" (see Rec. ITU-T X.680 | ISO/IEC
8824-1, 22.9) shall be "TextList" (see 10.2.8 b); and
g) the "XMLSequenceOfValue" and "XMLSetOfValue" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 26.3 and
28.3) shall be "XMLDelimitedItem" for all component types, with Table 5 ignored (see Rec. ITU-T
X.680 | ISO/IEC 8824-1, 26.5); and
h) the "xmlhstring" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.13) shall not contain "white-space" (see
8.1.4); and
i) all occurrences of "white-space" that is either outside XML tags or inside the values of XML attributes
can be "white-space with escapes" (see 8.1.5) as an encoder's option.
NOTE 3 – There are some encoding instructions (such as UNTAGGED) that cannot be used unless there is a GLOBAL-DEFAULTS of
MODIFIED-ENCODINGS.
10.2.8 If a GLOBAL-DEFAULTS encoding instruction with a MODIFIED-ENCODINGS keyword (see clause 26) is
present in the XER encoding control section, then an EXTENDED-XER encoder can (as an encoder's option):
a) use the "TextInteger" alternative of "ModifiedXMLIntegerValue" (see 17.8), provided there is a
"NamedNumber" for the integer value in the type definition (see also 10.2.7 b);
NOTE 1 – The use of this encoding with named values that have been added in a later version can make the
abstract value represented unreadable by an implementation of an earlier version of the specification.
b) use "XMLIdentifierList" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 22.9) for an "XMLBitStringValue",
provided the bitstring value to be encoded does not contain any "one" bits that are not named bits (see
also 10.2.7 f);
NOTE 2 – The use of this encoding with named bits that have been added in a later version can make the
abstract value represented unreadable by an implementation of an earlier version of the specification.
10.2.9 Where encoder's options are permitted in an EXTENDED-XER encoding, conforming decoders and
validators shall accept all options.
10.2.10 Conforming decoders and validators shall accept, but may ignore, the presence of a type identification
attribute in any XML element of an encoding unless its presence and use is as specified in clauses 37 and 38. Encoders
shall not generate such attributes except as specified in clauses 37 and 38.
NOTE – Other XML tools may insert such attributes. In general, an EXTENDED-XER decoder cannot easily determine the
permitted value and meaning of type identification attributes. Their presence and value may be of use to an application if (for
example) unexpected XML child elements are present that are (as a decoder's option) passed to the application – rather than
being ignored or producing a fatal decoding error.
10.2.11 An ASN.1 specification is illegal unless it is possible, for all abstract values, for a decoder to determine
unambiguously (using only the name of the XML tag and the contents of any previous XML element) the ASN.1
component (or extension marker) that an XML element is associated with.
NOTE 1 – The association cannot depend on the content of the XML element, or on its attributes, or on any subsequent XML
element.
NOTE 2 – This condition is always satisfied when there are no XER encoding instructions, but the inappropriate use of
UNTAGGED to remove associated tags round (for example) repetitions (sequence-of or set-of) and alternatives (choice) and the
inappropriate use of NAME can result in illegal specifications.
NOTE 3 – Subclause 10.2.11 is a necessary condition for valid encodings, but it is recognized that it is in general not possible for
an ASN.1 tool (or for a human author) to check for legality based on this top-level statement alone. Annex B provides a model
of the effect of the use of UNTAGGED, and rules that, if followed, can ensure legality of the specification as defined in 10.2.11.
10.2.12 If an ASN.1 specification contains "ObjectClassFieldType"s that are open types (see Rec. ITU-T X.681 |
ISO/IEC 8824-2, 14.2), with table constraints or type constraints, such constraints shall all be ignored in
applying 10.2.11.
11 Notation, character set and lexical items used in XER encoding instructions
11.1 The notation used in specifying the syntax of an "EncodingInstruction" in an XER type prefix (see clause 13),
and in an "EncodingInstructionAssignmentList" in an XER encoding control section (see clause 14) is that defined by
Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 5.
11.2 Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 11, applies to an XER "EncodingInstruction" and to an XER
"EncodingInstructionAssignmentList".
NOTE – In particular, arbitrary ASN.1 white-space characters can appear between lexical items in both of these syntactic
constructs unless the "&" notation is used (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 5.4).
11.3 The general rules specified in Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.1, also apply to an XER
"EncodingInstruction" and to an XER "EncodingInstructionAssignmentList".
NOTE – In particular, ASN.1 comment can be included wherever ASN.1 white-space is allowed, and requirements for the
insertion of white-space or comment between lexical items that could otherwise be confused are those specified in Rec. ITU-T
X.680 | ISO/IEC 8824-1.
11.4 The following lexical items are used in this Recommendation | International Standard:
comment (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.6)
cstring (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.14)
identifier (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.3)
modulereference (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.5)
number (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.8)
typereference (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.2)
"{" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"}" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"." (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
":" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"[" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"]" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"," (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
";" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
""" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"*" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"::=" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.20)
"<" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
">" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.37)
"</" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.28)
"/>" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.29)
Additional lexical items ("modifiedXMLNumber" and "modifiedXMLRealNumber") are defined and used in 17.8.3 and
in 17.9.
12 Keywords
12.1 The words specified in 12.3 and 12.4 below are used in either or both of XER "EncodingInstruction"s and
XER "EncodingInstructionAssignmentList"s (in addition to some ASN.1 reserved words), and can appear in such
syntactic constructs only with the meaning assigned to them in the following clauses of this Recommendation |
International Standard, except as specified in 12.2.
12.2 Keywords are not reserved words, but if an ASN.1 "typereference" that is the same as a keyword listed in 12.3
is needed in an XER "EncodingInstruction" or an XER "EncodingInstructionAssignmentList", then the production
"ModuleAndTypeReference" (see 14.2.2) shall be used.
12.3 The keywords are:
12.4 Additional keywords are used in the "BuiltInTypeName" production (see 14.2.3), but these are all ASN.1
reserved words (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.38) and can never be used in ASN.1 as a "typereference".
NOTE 1 – Alternatives of the "ExtendedXMLValue" production include both the (unchanged) "XMLValue"
production alternatives used in BASIC-XER, and alternative productions selected by XER encoding instructions.
b) change the associated tag name, the "AttributeName", or the value of the type identification attribute for
the encoding of that type; or
c) cause the "ExtendedXMLValue" of a component of an ASN.1 type to be inserted as the
"CharacterEncodableValue" in the "QuotedValue" of an "Attribute" (see 20.3.3); or
d) specify the XML namespace name for type reference names and identifiers defined in an ASN.1 module
and recommend a namespace prefix to be used with that namespace; or
e) specify when a namespace-qualified name (instead of an unqualified name) is to be used in an XML
element or as the name of an XML attribute; or
f) specify the removal of the associated tags, generally resulting in either untagged text or in partial XML
element content (which can be preceded or followed by other partial XML element content – see Annex
B); or
g) specify the insertion of one or more XML Processing Instructions or XML Comments (see clause 30):
1) before the associated preceding tag or the associated empty-element tag; or
2) between the associated preceding tag and the "ExtendedXMLValue"; or
NOTE 2 – This prohibits the use of an associated empty-element tag.
3) between the "ExtendedXMLValue" and the associated following tag; or
NOTE 3 – This prohibits the use of an associated empty-element tag.
4) after the associated following tag.
NOTE 4 – All the above prohibit the use of UNTAGGED to remove the associated tags (see 30.2.2).
13.2 XER encoding instructions can be assigned to ASN.1 types using either the "EncodingInstruction"
production in an XER type prefix or the "EncodingInstructionAssignmentList" production in an XER encoding
control section. Assignment using a type prefix is specified in this clause. Assignment using an XER encoding control
section is specified in clause 14.
NOTE – The effect of multiple assignments of encoding instructions of the same category is specified in clause 15.
NegatingInstruction ::=
NOT PositiveInstruction
| ElementInstruction
13.4 The "ElementInstruction" (see clause 24) is a strict synonym for NOT UNTAGGED, and is not discussed further
in this clause.
NOTE 1 – The ELEMENT synonym is provided to avoid the double negative, and for human readability of specifications. It will
normally be used (in opposition to the ATTRIBUTE encoding instruction) to identify the nature of top-level types in the ASN.1
module. Top-level types that have neither ELEMENT nor ATTRIBUTE final encoding instructions will be supporting types that do
not directly correspond to XML attributes or elements, and will usually be UNTAGGED.
NOTE 2 – There is no negating encoding instruction for ELEMENT. An ELEMENT encoding instruction can be cancelled by a
subsequent UNTAGGED encoding instruction, but such usage is not recommended.
13.5 Each use of a "PositiveInstruction" in an XER type prefix or in an XER encoding control section assigns that
XER encoding instruction to the corresponding "Type". Each of the alternatives of "PositiveInstruction" (for example
"AnyAttributesInstruction") has two alternatives. Only the first alternative of these shall be used in a type prefix.
13.6 If the "Type" in a "TypeAssignment" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 16.1) has final encoding
instructions, all uses of the corresponding "typereference" (in the module containing the "TypeAssignment" or in some
other module) inherit its final associated encoding instructions, except that any final NAME and NAMESPACE encoding
instructions are not inherited.
NOTE – These two encoding instructions affect the XML name used in place of a type reference name. Where the type reference
name is used to define the type in a type assignment or the type of a component, it is not appropriate to inherit such final
encoding instructions from its definition.
13.7 An encoding instruction in a type prefix or in an XER encoding control section can be a positive instruction,
used to add or to replace an encoding instruction (use of "PositiveInstruction"), or a negating instruction used to cancel
(use of "NegatingInstruction") one or more associated encoding instructions.
13.8 XER encoding instructions consist of four parts (some of which may be empty):
a) NOT, indicating negation or removal of encoding instructions of a given category; and
NOTE 1 – This is present for negating instructions (except "ElementInstruction") and absent for positive
instructions.
b) a keyword identifying the category of the encoding instruction; and
NOTE 2 – This is always present.
c) identification of a target list for the assignment of the encoding instruction (possibly with qualifying
information restricting its application to a subset of the values of the type); and
NOTE 3 – When used in a type prefix, the target list is always the "empty" production, as the target for the
assignment is always the type associated with the type prefix (see 13.12). The target list is also always "empty"
for the GLOBAL-DEFAULTS encoding instruction.
d) syntax, specific to each encoding instruction category, providing details of the encoding instruction in
that category.
NOTE 4 – When used in a negating instruction, this is always the "empty" production. It is also absent from
some XER encoding instructions for which the keyword is a sufficient definition.
13.9 Some XER encoding instructions require the specification of the abstract value of a type. This specification
uses the "Value" production (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 17.7). If a "valuereference" is used as "Value",
then this "valuereference" shall be defined in (or imported into) the ASN.1 module containing the XER encoding
instruction.
NOTE – This means that the value can be specified either directly using basic ASN.1 value notation, or by a value reference that
was specified using either basic ASN.1 value notation or XML value notation.
13.10 Table 1 lists in column 1 the alternatives in the "PositiveInstruction" productions. Column 2 gives the clauses
that specify the requirements for use of these encoding instructions and the modified encodings that they produce.
Column 3 gives the category of the encoding instruction.
NOTE – These categories are introduced in order to provide clear statements on the result of multiple assignments of encoding
instructions from the same category.
13.11 Each of the alternatives of the "PositiveInstruction" production is in a defined category of encoding
instruction (or in some cases encompasses multiple categories). The category of each encoding instruction is specified
in column 3 of Table 1 (but see also 15.3 for encoding instructions that encompass multiple categories).
NOTE – The categories of encoding instructions are used in 15.4 to determine the effect of multiple assignment of encoding
instructions.
13.12 The "TargetList" in all "EncodingInstruction" constructions that appear in a type prefix shall be "empty" and
the target shall be the "Type" associated with the type prefix.
13.13 A negating instruction is in the same category as the corresponding positive instruction.
13.14 An ASN.1 type can never have associated with it more than one XER encoding instruction of a given
category (see 15.3 and 15.4), no matter how they are assigned. The result of multiple assignments of an XER encoding
instruction of a given category is specified in clause 15.
14.1.4 Each use of an "EncodingInstruction" in an XER encoding control section assigns that XER encoding
instruction to the occurrences of "Type" that are identified in the "TargetList" of the encoding instruction, or to the type
references in an imports list. The "TargetList" production and the targets it identifies are specified in 14.2.
14.1.5 Subclauses 13.4 to 13.14 also apply to encoding instructions in an XER encoding control section. The clauses
defining the detailed syntax for each encoding instruction category are listed in Table 1. Categories of XER encoding
instructions are also listed in Table 1.
14.2 Identification of the targets for an XER encoding instruction using a target list
14.2.1 General rules
14.2.1.1 The "EncodingInstruction" alternatives specify the XER encoding instruction that is being assigned, and the
target(s) for that assignment within the ASN.1 module. All targets are an occurrence of the "Type" production within
the ASN.1 module.
NOTE – Multiple targets, in the same or in different ASN.1 type assignments, can be specified. A target that is the entire module,
or all occurrences within the module of a built-in type or constructor can also be specified. Thus (using an XER encoding control
section) a single "EncodingInstruction" can be used to assign a particular XER encoding instruction to all the types in an ASN.1
module that require to have that encoding instruction assigned.
14.2.1.2 In identifying the target(s) for the assignment of an XER encoding instruction, the production "TargetList" is
used. This is defined in the following subclauses.
NOTE 1 – The "TargetList" production is referenced in clauses 18 onwards.
NOTE 2 – The "TargetList" production has an "empty" alternative. This is the only permitted alternative if the
"EncodingInstruction" is used in a type prefix (see 13.12). This subclause 14.2 considers only the use of the "TargetList" in an
XER encoding control section.
14.2.1.5 A "TargetList" of "empty" is permitted only in a type prefix (when it is the only permitted alternative) and in
the GLOBAL-DEFAULTS encoding instruction. In a type prefix, it identifies the type associated with the prefix. In the
GLOBAL-DEFAULTS encoding instruction, it identifies all "Type"s in the module.
14.2.1.6 The XER encoding instruction (possibly with associated qualifying information) is assigned to all the types
identified by the "TargetList" as specified in 14.2.1.10 to 14.2.1.16.
NOTE – It would be unusual, but not illegal, for a given "Type" to be identified more than once in the target list. In such cases,
clause 15 applies.
14.2.1.7 (Tutorial) Identification of the target(s) (and possible qualifying information) by the "Targets" production uses
one of five basic forms:
a) use of a "typereference" (see 14.2.2), possibly followed by a dot-separated list of identifiers, identifying
either:
1) the "Type" in a type assignment (no identifiers present); or
2) the "Type" in a component of a type definition (which can include top-level components introduced
by the COMPONENTS OF construct – see 14.2.1.12); or
3) one of 1) or 2), plus a final identifier (preceded by a colon, not a dot) for an identifier used in the
target type definition, providing the qualifying information;
b) use of ALL as the last identifier in the a) form, identifying all of the "Type"s textually present in the type
definition (that is identified by the preceding type reference and dot-separated list of identifiers), or
qualifying information (preceded by a colon, not a dot) identifying all of the identifiers used for values of
a boolean, bitstring, enumerated, or integer type definition (that is identified by the preceding type
reference and dot-separated list of identifiers) or identifying all uses of the XML empty-element tags
used to represent some control characters (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.15.5);
c) use of a "BuiltInTypeName" (see 14.2.3), identifying all "Type"s in the module that are defined by use of
the corresponding built-in type name or constructor, possibly (in the case of BOOLEAN, BIT STRING,
ENUMERATED, INTEGER and restricted character string types only) followed by qualifying information;
d) use of a list of "identifier"s followed by IN (or ALL followed by IN, or COMPONENTS followed by IN)
and the a) form above (see also 14.2.4), identifying:
1) the "Type" of the identified components of the a) form; or
2) (use of ALL) all "Type"s that textually occur within the "Type" identified by the a) form; or
3) (use of COMPONENTS) all "Type"s that are the top-level components of the "Type" identified by the
a) form;
e) use of "ImportedTypesIdentification" (see 14.2.5) identifies all the "typereference"s in the IMPORTS list
that are imported from a specified module.
NOTE 1 – The term "type definition" used in a) and b) above emphasizes that only textually present identifiers can be used.
Identifiers cannot be used if the "Type" is a type reference.
NOTE 2 – In general a component can be referenced by use of a) or d) above. If more than one component of a type is to be
referenced, then d) would be preferred as it is less verbose, otherwise a) would be preferred. This is a matter of style.
14.2.1.8 A bitstring or octetstring type with a contents constraint that contains a type shall be treated as a type with a
single component, using "*" as the component identifier, for the purpose of assigning a targeted instruction to the
"Type" in the contents constraint.
14.2.1.9 A type definition that is a sequence-of or a set-of shall be treated as a type with a single component, using "*"
as the component identifier, for the purpose of assigning a targeted instruction to the "Type" that is the component of
the sequence-of or set-of.
NOTE – It is also possible to identify this single component using the component identifier (if present).
14.2.1.10 If a target is a dummy type reference within a parameterized assignment, then in each instantiation of the
parameterized assignment, the target inherits the final encoding instructions of the actual parameter (a "Type") assigned
to the dummy reference. Such inheritance occurs before encoding instructions targeting the dummy reference are
assigned to it. The specification is legal only if the resulting final encoding instructions for all instantiations of the
parameterized type are legal.
NOTE 1 – If the parameterized type is exported, the final encoding instructions for its dummy parameters are carried with it.
NOTE 2 – There are no mechanisms provided to assign encoding instructions directly to the "Type" of an actual parameter in an
instantiation of a parameterized type.
14.2.1.11 If the target is a "SelectionType", the target inherits the final encoding instructions of the selected
alternative of the choice type referenced by the selection type, after which encoding instructions assigned to the
"SelectionType" are assigned.
14.2.1.12 If the target is a component produced as a result of the COMPONENTS OF transformation, the target inherits
the final encoding instructions of the component of the type referenced by the COMPONENTS OF, after which encoding
instructions assigned to the components produced by the COMPONENTS OF are assigned. Any encoding instructions for
the "Type" from which the components are extracted are ignored.
14.2.1.13 If the "Targets" production is "TypeIdentification", then the targets it identifies are specified in 14.2.2.
14.2.1.14 If the "Targets" production is "BuiltInTypeIdentification", then the targets it identifies are specified
in 14.2.3.
14.2.1.15 If the "Targets" production is "IdentifiersInContext", then the targets it identifies are specified in 14.2.4.
14.2.1.16 If the "Targets" production is "ImportedTypesIdentification", then the targets it identifies are specified
in 14.2.5.
14.2.1.17 EXAMPLE: The example below shows an ASN.1 type definition followed by two different ways of
assigning XER encoding instructions in an XER encoding control section, and finally, the same ASN.1 type definition
with the XER encoding instructions assigned using type prefixes. All three approaches result in the same EXTENDED-
XER encoding.
The XER encoding instructions in the encoding control section could be:
ATTRIBUTE field1 IN My-Type
LIST first IN My-Type.field2
14.2.2.5 If ALL is used as a "ComponentId", it shall be the last "ComponentId" in the "ComponentIdList" and shall not
be followed by "QualifyingInformation".
14.2.2.6 If the first "ComponentId" in the "ComponentIdList" (if present) is an identifier that is textually present (or
results from use of COMPONENTS OF) as a component identifier in the "Type" identified by the
"ModuleAndTypeReference", then it identifies the "Type" of that component. If it is not an identifier that is textually
present (or results from use of COMPONENTS OF) as a component identifier in the "Type" identified by the
"ModuleAndTypeReference", then this occurrence of "TypeIdentification" is not illegal, but does not identify any
target.
NOTE – This requires that the type referenced by the "ModuleAndTypeReference" be a sequence, set, choice, sequence-of or set-
of type definition, or a bitstring or an octetstring type definition with a contents constraint that contains a "Type".
14.2.2.7 If a subsequent "ComponentId" (except the last) in the "ComponentIdList" (if present) is an identifier that is
textually present as a component identifier in the "Type" identified by the previous "ComponentId", then it identifies the
"Type" of that component. If it is not a component identifier that is textually present in the "Type" identified by the
previous "ComponentId", then this occurrence of "TypeIdentification" is not illegal, but does not identify any target.
NOTE – The first use of "ComponentId" can refer to components introduced by a COMPONENTS OF. Components of those
components cannot be identified by subsequent "ComponentId"s.
| BOOLEAN
| CHARACTER STRING
| CHOICE
| DATE
| DATE-TIME
| DURATION
| EMBEDDED PDV
| ENUMERATED
| EXTERNAL
| GeneralizedTime
| INSTANCE OF
| INTEGER
| NULL
| ObjectDescriptor
| OBJECT IDENTIFIER
| OCTET STRING
| OID-IRI
| REAL
| RELATIVE-OID
| RELATIVE-OID-IRI
| SEQUENCE
| SEQUENCE OF
| SET
| SET OF
| TIME
| TIME-OF-DAY
| UTCTime
| RestrictedCharacterStringType
BuiltInTypeQualifyingInformationPart ::=
":"
BuiltInTypeQualifyingInformation
BuiltInTypeQualifyingInformation
identifier
| ALL
14.2.3.2 The "BuiltInTypeIdentification" production specifies that the encoding instruction is to be applied to all
textual occurrences within the module of the corresponding built-in type or of a type defined using the corresponding
constructor.
14.2.3.3 The "RestrictedCharacterStringType" is defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 41.
14.2.3.4 The "BuiltInTypeQualifyingInformationPart" shall not be present unless the "BuiltInTypeName" is BOOLEAN,
BIT STRING, ENUMERATED, INTEGER, or a restricted character string type.
NOTE – Only the ALL form of "BuiltInTypeQualifyingInformation" is permitted for a restricted character string type (see
14.2.2.10 and the next subclause).
14.2.3.5 The "identifier" alternative of "BuiltInTypeQualifyingInformation" shall not be used unless the
"BuiltInTypeName" is BOOLEAN, and shall then be either true or false. It specifies qualifying information that
identifies that the encoding instruction applies only to the encoding of the TRUE or the FALSE abstract values,
respectively.
14.2.3.6 The ALL alternative of "BuiltInQualifyingInformation" specifies qualifying information that identifies that the
encoding instruction applies to all identifiers used in any instance of use of the "BuiltInTypeName" within the module
(or to all values of the BOOLEAN type definition, or to all the empty-element tags used in values of the specified
restricted character string type – see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.15.5).
TypeIdentification
IdentifierList ::=
identifier "," +
| ALL
| COMPONENTS
14.2.4.2 "TypeIdentification" is defined in 14.2.2, and identifies a type defined in a type assignment statement in the
module, or a component or sub-component of a type defined in the module. The "QualifyingInformationPart" shall be
absent.
14.2.4.3 The "Type" identified by the "TypeIdentification" shall be a sequence, set or choice type, and is called for the
purposes of this clause the identified "Type".
NOTE – The "TypeIdentification" in "IdentifiersInContext" cannot be used for a sequence-of or set-of type. Such use is
prohibited for clarity, as it would be no less verbose than direct use of "TypeIdentification" in "Targets".
14.2.4.4 Each "identifier" in "IdentifierList" shall be the "identifier" of a component of the identified "Type". The XER
encoding instruction is assigned to the "Type" of all the components of the identified "Type" that have a component
"identifier" in the "IdentifierList".
14.2.4.5 The use of ALL for "IdentifierList" specifies that all textually present components (and all textually present
components of those components, to any depth) in the identified "Type" are targets to which the XER encoding
instruction is being assigned.
14.2.4.6 The use of COMPONENTS for "IdentifierList" specifies that all components (at the first level) of the identified
"Type" are targets to which the XER encoding instruction is being assigned.
14.2.5.2 The "modulereference" shall be one of the "modulereference"s used in one of the "GlobalModuleReferences"
of the imports clause of the module.
14.2.5.3 The XER encoding instruction is assigned to each of the "typereference"s in the corresponding "SymbolList",
after the final encoding instructions produced by assignment in the exporting module have been assigned.
14.2.5.4 If an imported "typereference" is exported from this module, the final encoding instructions inherited by that
"typereference" in a module that imports it are those inherited in this importing module, and are not affected by
assignment of encoding instructions using an "ImportedTypesIdentification". This assignment affects only the use of the
type reference within this module.
15.1.4 Prefixed encoding instructions (using a type prefix) assigned to a type are considered next, with the rightmost
(the innermost) prefixed encoding instruction considered first, and the leftmost (the outermost) prefixed encoding
instruction considered last.
15.1.5 As specified in 14.2.1.10, encoding instructions are assigned to a dummy parameter only after the final
encoding instructions for the actual parameter have been determined.
15.1.6 As specified in 14.2.1.11 and 14.2.1.12, a "SelectionType" and the components produced by a COMPONENTS
OF transformation inherit first the final encoding instructions of the original type, and then have encoding instructions
targeted at them applied.
15.1.7 Each assignment of an encoding instruction produces a new set of associated encoding instructions, as
specified in 15.2 to 15.4.
15.4.1 Assignments of positive encoding instructions result in the addition (to the set of associated encoding
instructions) of that XER encoding instruction if there are no other associated encoding instructions of the same
category.
15.4.2 Assignment of an ELEMENT encoding instruction is always equivalent to assignment of a NOT UNTAGGED
encoding instruction.
15.4.3 If there is an encoding instruction of the same category in the set of associated encoding instructions, then that
encoding instruction is removed from the set, and the assigned XER encoding instruction is added.
NOTE – If encoding instructions are being assigned globally in an XER encoding control section, with the intention of overriding
them in specific cases, then the overriding has to be done using either a type prefix or a later encoding instruction in the XER
encoding control section, not an earlier one.
15.5.2 Table 3 specifies the permitted combinations of final encoding instructions when a GLOBAL-DEFAULTS of
MODIFIED-ENCODINGS has not been used. Column 1 lists all encoding instructions that are permitted as final encoding
instructions if a GLOBAL-DEFAULTS of MODIFIED-ENCODINGS has not been used. Column 2 either says "Not permitted"
or lists all the encoding instructions that can be used in combination with the column 1 encoding instruction as final
encoding instructions, but in many cases restrictions apply that are listed in the applicable clauses. "Not permitted"
means that that encoding instruction cannot be used as a final encoding instruction if a GLOBAL-DEFAULTS of
MODIFIED-ENCODINGS has not been used.
NOTE – GLOBAL-DEFAULTS is not listed in the table, as this is not assigned to a "Type".
16 XER encoding instruction support for XML namespaces and qualified names
16.1 W3C XML Namespaces defines concepts and rules governing necessary qualifiers and mechanisms to ensure
that an XML element name or attribute name can be correctly identified with a corresponding specification of the
associated semantics.
16.2 W3C XML Namespaces defines an XML namespace as a collection of unambiguous names, identified by a
URI, which are used in XML documents as element types and attribute names. The URI that identifies a namespace is
called the namespace name. In this Recommendation | International Standard, namespaces are also used to qualify the
values of a type that has a final encoding instruction of USE-QNAME (see clause 36) and that represents an XML QName
(see W3C XML Schema, Part 2, 3.2.18).
16.3 Type reference names and identifiers can (but need not) be assigned a namespace.
NOTE – This Recommendation | International Standard uses a namespace name that is, by default, a form of URI based on
ASN.1 object identifiers (see clause 29). All other forms of URI can be used to assign a namespace name to the names in an
ASN.1 module.
16.4 Whether or not a type is part of an XML namespace (and if so its namespace name) is determined by the
presence (or absence) of a final NAMESPACE encoding instruction.
NOTE – A NAMESPACE encoding instruction can only be present if a GLOBAL-DEFAULTS MODIFIED-ENCODINGS encoding
instruction is also present in the XER encoding control section (see 29.2.1).
16.5 A namespace is identified by the "NameSpaceSpecification" production that provides the Uniform Resource
Identifier for the namespace, and optionally a recommended namespace prefix. The "NameSpaceSpecification" is
specified in clause 29.
16.6 Names of XML elements and attributes in an EXTENDED-XER encoding are generated from several
sources. The subclauses of 16.8 list the sources of XML element and attribute names, identify what namespace they are
part of, and specify whether they are to be namespace-qualified names or not.
16.7 An XML element name, an XML attribute name, or a value of a type identification attribute may (but need
not) have a final NAMESPACE encoding instruction on the "Type" that generates the name. If it does, then the name shall
be a namespace-qualified name in the encoding. (The namespace-qualification in an encoding can be done either
explicitly using a defined XML namespace prefix, or indirectly by establishing a default XML namespace for a scope
that includes the use of the name or of the value.) If there is no NAMESPACE encoding instruction on a "Type" that
generates a name, then the name is not a namespace-qualified name. Names that are not namespace-qualified names are
called unqualified names, and shall not occur in the scope of an established default XML namespace.
NOTE – BASIC-XER does not support XML namespaces, and namespace-qualified names never occur in BASIC-XER
encodings.
16.8 In the following subclauses, the term "ASN.1 namespace" refers to the namespace whose name and
recommended prefix are specified in 16.9. The term "assigned namespace" refers to the namespace assigned by the
NAMESPACE encoding instruction to a type. If generated names are not from the ASN.1 namespace, and there is no such
assignment of a namespace name, then the XML element names, XML attribute names, and values of type
identification attributes are unqualified names.
16.8.1 In all the subclauses of this 16.8, the element names and attribute names in the XML tags (whether XML
empty-element tags or start tags) are namespace-qualified names in an encoding if and only if the generating "Type" has
a final NAMESPACE encoding instruction.
16.8.2 Element names in XML empty-element tags used for control characters (see Rec. ITU-T X.680 | ISO/IEC
8824-1, 12.15.5) have no namespace unless one is assigned by the application of a NAMESPACE encoding instruction to
the restricted character string type with qualifying information of ALL.
16.8.3 Element names in XML empty-element tags used for values of the integer, enumerated, bitstring types, and
special values of real types (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 19.9, 20.8, 21.6 and 22.9) will always be
unqualified names (see 16.7) in an encoding of these types.
16.9 The namespace of the type identification attribute (see clause 37) and of the nil identification attribute (see
clause 33) is the control namespace, which is, by default, the ASN.1 namespace, unless a different control namespace is
specified by a GLOBAL-DEFAULTS encoding instruction (see clause 26). The ASN.1 namespace has a name of
"urn:oid:2.1.5.2.0.1" (see 40.3), and a recommended namespace prefix of "asn1". (See also 26.3.2.)
16.10 For an octetstring type with a contents constraint that specifies an EXTENDED-XER encoding, any abstract
value of the octetstring type shall be a complete EXTENDED-XER encoding of a value of an ASN.1 type (see Rec.
ITU-T X.682 | ISO/IEC 8824-3, 11.5 and 11.6), and shall contain all necessary namespace declarations for all prefixed
and unprefixed qualified names present in the octetstring abstract value.
NOTE – Such an octetstring type is encoded as an "xmlhstring" or "Base64OctetStringValue". Any namespace declarations
present in the XML document that contains the "xmlhstring" or "Base64OctetStringValue" do not include in their scope the
names present in the octet string.
16.11 When an open type is encoded as an "xmlhstring" or "Base64XMLOpenTypeFieldVal", and the encoding
rules used for the contained type are EXTENDED-XER, the "xmlhstring" or the "Base64XMLOpenTypeFieldVal" shall
be the hexadecimal or base64 representation (respectively) of an octet string that is a complete EXTENDED-XER
encoding of a value of the contained type, and shall contain all necessary namespace declarations for all prefixed and
unprefixed qualified names present in it.
NOTE – Any namespace declarations present in the XML document that contains the "xmlhstring" or the
"Base64XMLOpenTypeFieldVal" do not include in their scope the names present in the octet string.
ExtendedXMLBuiltinValue ::=
XMLBitStringValue
| XMLBooleanValue
| ExtendedXMLCharacterStringValue
| ExtendedXMLChoiceValue
| XMLEmbeddedPDVValue
| ExtendedXMLEnumeratedValue
| XMLExternalValue
| XMLInstanceOfValue
| ExtendedXMLIntegerValue
| XMLIRIValue
| XMLNullValue
| XMLObjectIdentifierValue
| ExtendedXMLOctetStringValue
| ExtendedXMLRealValue
| XMLRelativeIRIValue
| XMLRelativeOIDValue
| ExtendedXMLSequenceValue
| ExtendedXMLSequenceOfValue
| ExtendedXMLSetValue
| ExtendedXMLSetOfValue
| ExtendedXMLPrefixedValue
ExtendedXMLCharacterStringValue ::=
ExtendedXMLRestrictedCharacterStringValue
| XMLUnrestrictedCharacterStringValue
ExtendedXMLRestrictedCharacterStringValue ::=
XMLRestrictedCharacterStringValue
| Base64XMLRestrictedCharacterStringValue
ExtendedXMLObjectClassFieldValue ::=
ExtendedXMLOpenTypeFieldVal
| XMLFixedTypeFieldVal
ExtendedXMLOpenTypeFieldVal ::=
ExtendedXMLTypedValue
| Base64XMLOpenTypeFieldVal
| xmlhstring
ExtendedXMLOctetStringValue ::=
ExtendedXMLTypedValue
| Base64XMLOctetStringValue
| xmlhstring
ExtendedXMLRealValue ::=
XMLRealValue
| ModifiedXMLRealValue
ExtendedXMLIntegerValue ::=
XMLIntegerValue
| ModifiedXMLIntegerValue
ExtendedXMLPrefixedValue ::=
ExtendedXMLValue
17.4.2 The alternatives of "ExtendedXMLBuiltinValue" whose production names do not start with "Extended", and
their use to encode abstract values, are fully specified in Rec. ITU-T X.680 | ISO/IEC 8824-1 (see 17.10 and 17.2 of
that Recommendation | International Standard) and (for "XMLFixedTypeFieldVal" and the third alternative of
"ExtendedXMLOpenTypeFieldVal") in Rec. ITU-T X.681 | ISO/IEC 8824-2, 14.6.
17.4.3 The "Base64XMLRestrictedCharacterStringValue" is defined in 21.3.5 and shall only be used as specified in
that subclause.
17.4.4 The "ExtendedXMLChoiceValue" is defined in 17.5 and shall only be used as specified in that subclause.
17.4.5 The "ExtendedXMLEnumeratedValue" is defined in 34.3 and shall only be used as specified in that
subclause.
17.4.6 The "ExtendedXMLSequenceValue" and "ExtendedXMLSetValue" are defined in 17.6 and shall only be used
as specified in that subclause.
17.4.7 The "ExtendedXMLSequenceOfValue" and "ExtendedXMLSetOfValue" are defined in 17.7 and shall only be
used as specified in that subclause.
17.4.8 The "Base64XMLOctetStringValue" and "Base64XMLOpenTypeFieldVal" are defined in 21.3.2 and 21.3.4
and shall only be used as specified in those subclauses.
17.4.9 The "ModifiedXMLIntegerValue" is defined in 17.8 and shall only be used as specified in that subclause.
17.4.10 The "ModifiedXMLRealValue" is defined in 17.9 and shall only be used as specified in that subclause.
17.4.11 The "empty" alternative of "ExtendedXMLValue" shall only be used as specified in clause 23.
NOTE – The other alternatives of "ExtendedXMLValue" can also produce an "empty" lexical item. This subclause does not
affect the use of such occurrences.
ExtendedXMLValue
"</" & TagName ">"
| ExtendedXMLValue
17.6.2 The "empty" alternatives of "ExtendedXMLSequenceValue" and "ExtendedXMLSetValue" shall only be used
if no component of the sequence or set type (to any depth), after resolution of all type references and after application of
all final encoding instructions, produces an "ExtendedXMLNamedValue".
NOTE – This includes (but is not limited to) the cases in which all components are marked DEFAULT or OPTIONAL and all
values are omitted; have a final UNTAGGED encoding instruction and their values have an empty encoding; have a final
ATTRIBUTE encoding instruction. It also includes combinations of the above, and the case in which the type notation is
SEQUENCE {} or SET {}. {}
17.6.3 The "TagName" is defined in 17.5.1. The "QualifiedOrUnqualifiedName" in the
"IdentifierOrModifiedIdentifier" form of "TagName" shall be used if and only if there is a final NAME or NAMESPACE
encoding instruction applied to the type (see clause 29), otherwise the "identifier" shall be used.
17.6.4 The "AttributeList" and its use is defined in 17.3 and the clauses it references.
17.6.5 The "ExtendedXMLValue" in both alternatives of the "ExtendedXMLNamedValue" shall be the
"ExtendedXMLValue" of the component of the sequence or set type.
17.6.6 The second alternative of "ExtendedXMLSequenceValue" and "ExtendedXMLSetValue" shall be used if and
only if the alternative has an UNTAGGED final encoding instruction (see clause 32).
17.7.6 The third alternative of "ExtendedXMLDelimitedItem" shall be used if and only if the component of the
sequence-of or set-of type has a final UNTAGGED encoding instruction (see clause 32).
17.7.7 The "ExtendedXMLValue" in all the alternatives of the "ExtendedXMLDelimitedItem" shall be the
"ExtendedXMLValue" of the repeated component of the sequence-of or set-of type.
17.7.8 The "TypeNameOrModifiedTypeName" in the "ExtendedXMLValueOrEmpty" shall be the
"xmlasn1typename" specified in Rec. ITU-T X.680 | ISO/IEC 8824- 1, Table 4, corresponding to the built-in type of the
component, possibly modified in accordance with any final NAMESPACE encoding instruction applied to the component
(see clause 29).
17.8.4 Any positive integer value can be encoded using either the first or the third alternative of
"ModifiedXMLSignedNumber", as an encoder's option. A negative integer value shall be encoded using the second
alternative. The integer value zero can be encoded using any of the three alternatives, as an encoder's option.
17.8.5 "TextInteger" is defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, 19.9, and provides an alternative encoding
(as an encoder's option) for integer values that have a "NamedNumber" definition.
ModifiedXMLRealValue ::=
ModifiedXMLNumericRealValue
| XMLSpecialRealValue
| XMLDecimalMinusZeroRealValue
ModifiedXMLNumericRealValue ::=
modifiedXMLRealNumber
| "-" & modifiedXMLRealNumber
| "+" & modifiedXMLRealNumber
17.9.2 This alternative of "ExtendedXMLRealValue" (see 17.4) shall only be used if a GLOBAL-DEFAULTS encoding
instruction with a MODIFIED-ENCODINGS keyword is assigned.
17.9.3 The "modifiedXMLRealNumber" lexical item shall consist of an integer part that is a series of one or more
digits, and optionally a decimal point (.). The decimal point can optionally be followed by a fractional part that is one or
more digits. The integer part, decimal point or fractional part (whichever is last present) can optionally be followed by
an e or E and an optionally-signed exponent which is one or more digits.
NOTE – This lexical item differs from the "realnumber" (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.9) lexical item only
because it permits any number of leading zeros in the exponent.
17.9.4 Any positive real value and the real value plus zero can be encoded using either the first or the third
alternative of "ModifiedXMLNumericRealValue", as an encoder's option. Any negative real value shall be encoded
using the second alternative of "ModifiedXMLNumericRealValue". The real value minus zero shall be encoded using
the second alternative.
17.9.5 The "XMLDecimalMinusZeroRealValue" is defined in 22.3.2 and shall only be used as specified in that
subclause.
NOTE – The DECIMAL encoding instruction defined in 22.3.2 provides this production as an alternative representation for the
positive zero abstract real value, but requires that the minus zero abstract value be excluded from the type to which it is applied.
18.1 General
18.1.1 The "AnyAttributesInstruction" is:
AnyAttributesInstruction ::=
ANY-ATTRIBUTES TargetList NamespaceRestriction ?
| ANY-ATTRIBUTES NamespaceRestriction ? "]" TargetList
NamespaceRestriction ::=
FROM URIList
| EXCEPT URIList
URIList ::=
QuotedURIorAbsent
| URIList QuotedURIorAbsent
QuotedURIorAbsent ::=
QuotedURI
| ABSENT
18.1.2 The "TargetList" production is defined in 14.2.
18.1.3 The "QuotedURI" is defined in 29.1.1.
18.1.4 This encoding instruction is assigned to an ASN.1 type that is a sequence-of or set-of type with a
UTF8String component whose value provides zero, one or more attribute names and values (one in each
UTF8String), each of which is subject to any "NamespaceRestriction" that is present (see 18.2).
NOTE – Although sequence-of may be used for the specification of the attributes, this use of sequence-of does not imply that
order is semantically significant, and the encoding/decoding process may result in a different order of the components of the
sequence-of.
18.1.5 The content of each UTF8String is encoded as an "Attribute" of the enclosing XML element. The name of
the sequence-of or set-of component is ignored.
18.1.6 The FROM and EXCEPT clauses (if present) identify lists of namespace names, or the special keyword ABSENT.
18.1.7 FROM restricts attribute names to be namespace-qualified names from one of the specified namespaces. If
ABSENT is present in the "URIList", unqualified names can also be used.
18.1.8 EXCEPT allows namespace-qualified names from any namespaces except those listed. It also allows
unqualified names unless ABSENT is present in the "URIList".
18.2 Restrictions
18.2.1 An ASN.1 type shall not have this final encoding instruction unless it is a set-of or sequence-of type with a
component that is a UTF8String type.
18.2.2 A type with this final encoding instruction shall only be used as a component of an enclosing sequence or set
type, and the component shall not be marked OPTIONAL or DEFAULT. There shall only be one such component in the
enclosing type.
18.2.3 A sequence-of or set-of type with this final encoding instruction is required to have a constraint applied to it
that imposes the format and content specified in 18.2.6 to 18.2.11 on each occurrence of the UTF8String, by reference
to this clause 18 or otherwise.
NOTE – It is recommended that the constraint on the sequence-of or set-of type be expressed as:
(CONSTRAINED BY
{/* Each UTF8String shall conform to the "AnyAttributeFormat" specified in
Rec. ITU-T X.693 | ISO/IEC 8825-4, clause 18. */})
18.2.4 There shall be no final UNTAGGED encoding instruction on either the type that has this final encoding
instruction or on the enclosing type.
18.2.5 Each "URIList" shall contain at most one occurrence of ABSENT and shall not contain two identical
"QuotedURI"s.
18.2.6 The format of each UTF8String shall conform to the production "AnyAttributeFormat":
AnyAttributeFormat ::=
URI ?
NCName & "=" & xmlcstring
18.2.7 See 29.1.4 for the definition of the "URI" production, and 29.1.7 for the definition of the "NCName"
production. The "xmlcstring" lexical item is defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, 12.15.
18.2.8 If there is a "NamespaceRestriction" of FROM, then the "URI" in "AnyAttributeFormat" shall be the "URI" in a
"QuotedURI" in the "URIList", and may be absent only if the keyword ABSENT occurs in the "URIList".
18.2.9 If there is a "NamespaceRestriction" of EXCEPT, then the "URI" in "AnyAttributeFormat" shall not be the
"URI" in a "QuotedURI" in the "URIList", and shall not be absent if the keyword ABSENT occurs in the "URIList".
18.2.10 The "xmlcstring" shall be a syntactically correct XML attribute value (defined in W3C XML, clause 3)
preceded and followed by either a single APOSTROPHE (39) character or by a single QUOTATION MARK (34)
character.
18.2.11 Application of this encoding instruction and the ATTRIBUTE encoding instruction to different components of
the enclosing type shall not violate 20.3.11.
18.2.12 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULT MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
18.2.13 A type with this final encoding instruction shall not also have any of the final encoding instructions LIST,
PI-OR-COMMENT or UNTAGGED.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ELEMENT, ATTRIBUTE, BASE64, DECIMAL, DEFAULT-FOR-EMPTY, EMBED-VALUES,
TEXT, USE-NIL, USE-NUMBER, USE-ORDER, USE-QNAME, USE-TYPE, USE-UNION, WHITESPACE.
of the enclosing type shall be encoded using the value of each UTF8String as an "Attribute" (see clause 20) of the
enclosing element as specified below.
18.3.3 The encoder shall:
a) treat each "URI" that is present in a UTF8String as requiring that the following "NCName" (the attribute
name) be namespace-qualified with the namespace specified by the "URI", and treat the absence of a
"URI" in a UTF8String as specifying that the following "NCName" shall not be namespace-qualified,
and shall then remove the "URI" from the UTF8String; and
b) insert into the encoding any necessary namespace declarations with scopes that include the inserted
attributes, in order to ensure that the required namespace-qualification of the "NCName"s identified in a)
above can be achieved; and
c) insert each UTF8String (after the "URI" has been removed) as an attribute in the enclosing element,
inserting namespace prefixes as necessary before each "NCName" in order to ensure that the
requirements of a) above are satisfied.
18.3.4 The order of all attributes in the enclosing element (resulting from the presence of one or more components of
the enclosing type with a final ATTRIBUTE or ANY-ATTRIBUTES encoding instruction) is an encoder's option.
18.3.5 An EXTENDED-XER decoder shall generate a UTF8String in the format of 18.2.6 for each attribute in the
enclosing element that is not from the control namespace, and whose name is not that of the identifier (possibly
modified in accordance with any final NAME or NAMESPACE encoding instructions) of another component of the
enclosing type that has a final ATTRIBUTE encoding instruction.
19.1 General
19.1.1 The "AnyElementInstruction" is:
AnyElementInstruction ::=
ANY-ELEMENT TargetList NamespaceRestriction ?
| ANY-ELEMENT NamespaceRestriction ? "]" TargetList
19.1.2 The "TargetList" production is defined in 14.2.
19.1.3 The "NamespaceRestriction" is defined in 18.1.
19.1.4 This encoding instruction enables an ASN.1 type that is an octetstring or a UTF8String to provide the
specification of a single XML element.
NOTE – The content and attributes of the XML element are unrestricted. It may have attributes or child elements, and names of
child elements and attributes may be qualified or unqualified, and are not affected by any "NamespaceRestriction".
19.1.5 If there is a "NamespaceRestriction", then the element name is required to satisfy the "NamespaceRestriction"
(see 18.1.6 to 18.1.8) but is otherwise unrestricted.
19.1.6 The type with this final encoding instruction may be the root type of the encoding, or may be a component of
a choice, sequence, set, sequence-of or set-of type. If it is a top-level type, the type reference name is ignored. If it is a
component, the identifier is ignored.
19.2 Restrictions
19.2.1 An ASN.1 type shall not have this final encoding instruction unless it is an octetstring or a UTF8String type
restricted as follows:
a) if the type is an octetstring type, it is required to have a restriction applied to it so that each abstract value
is a fast infoset document in conformance with Rec. ITU-T X.891 | ISO/IEC 24824-1;
NOTE 1 – It is recommended that the constraint on the octetstring be expressed as:
(CONSTRAINED BY
{/* Shall be a fast infoset document in conformance with
24824-1. */})
Rec. ITU-T X.891 | ISO/IEC 24824-1.
b) if the type is a UTF8String, it is required to have a restriction applied to it that imposes the format and
content specified in 19.2.4 to 19.2.9 by reference to this clause 19 or otherwise.
NOTE 2 – It is recommended that the constraint on the UTF8String be expressed as:
(CONSTRAINED BY
{/* Shall conform to the "AnyElementFormat" specified in
Rec. ITU-T X.693 | ISO/IEC 8825-4, clause 19. */})
19.3.4 When this encoding instruction is applied to an octetstring, an EXTENDED-XER decoder shall convert the
next XML element in the encoding to an XML document that has that element as its root element, and shall convert that
XML document to a fast infoset document.
19.3.5 When this encoding instruction is applied to a UTF8String, an EXTENDED-XER decoder shall generate the
format of 19.2.4 from the next XML element in the encoding, as the abstract value of the UTF8String.
19.3.6 The decoder shall include in the root element of the fast infoset document or in the topmost element in the
UTF8String namespace declaration attributes for all namespace declarations that are in scope for the element being
decoded but that are not present in that element.
20.1 General
20.1.1 The "AttributeInstruction" is:
AttributeInstruction ::=
ATTRIBUTE TargetList
| ATTRIBUTE "]" TargetList
20.2 Restrictions
20.2.1 An ASN.1 type shall not have this final encoding instruction unless it has at least one "ExtendedXMLValue"
encoding (taking account of encoder's options), for each of its abstract values, that does not contain any XML tags and
does not rely on the use of "xmlhstring" (if the type is an open type or octetstring type) or "xmlbstring" (if the type is a
bitstring type) or on a final UNTAGGED, ATTRIBUTE, or ANY-ATTRIBUTES encoding instruction applied to its
components (if the type is a sequence or set type) to achieve this.
NOTE 1 – This implies that a restricted character string type with a final ATTRIBUTE encoding instruction has to be restricted so
that it does not contain any of the control characters listed in Rec. ITU-T X.680 | ISO/IEC 8824-1, Table 3 (Escape sequences for
control characters in an "xmlcstring"), or has to have a final BASE64 encoding instruction.
NOTE 2 – This does not include open types, or octetstring and bitstring types with CONTAINING without ENCODED BY, BY
because their "ExtendedXMLValue" can contain tags unless they are encoded as an "xmlhstring".
NOTE 3 – It is recognized that some ASN.1 tools may not be able to statically check that the above restriction will be satisfied
for all abstract values, but conforming encoders cannot generate encodings in which the "ExtendedXMLValue" violates this
restriction (see 20.3.14).
20.2.2 A type with this final encoding instruction shall only be used as a component of a sequence or set type.
NOTE – The component may be OPTIONAL or DEFAULT.
20.2.3 There shall be no final UNTAGGED encoding instruction on either the type that has this final encoding
instruction or on the enclosing type that contains it as a component.
20.2.4 If the final encoding instructions on other components of the enclosing type include either this encoding
instruction or the ANY-ATTRIBUTES encoding instruction, 20.3.11 shall not be violated.
20.2.5 A type with this final encoding instruction shall not also have any of the final encoding instructions ANY-
ELEMENT, DEFAULT-FOR-EMPTY, PI-OR-COMMENT or UNTAGGED.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, EMBED-VALUES, USE-NIL, USE-ORDER, USE-TYPE.
QuotedValue ::=
DoubleQuotedValue
| SingleQuotedValue
DoubleQuotedValue ::=
""" & CharacterEncodableValue & """
SingleQuotedValue ::=
"'" & CharacterEncodableValue & "'"
ControlAttributeName ::= QualifiedName
CharacterEncodableValue ::= ExtendedXMLValue
20.3.4 The "IdentifierOrModifiedIdentifier" production is defined in 17.5.1, and its use in the context of this
encoding instruction is defined in 17.6.3.
20.3.5 The "ControlAttributeName" production is not directly used by this clause. All "QualifiedName"s in this
production are from the control namespace (see 16.9). Such attributes are only generated in accordance with clauses 33
and 37, but unexpected control attributes are required to be accepted by decoders (see 10.2.10).
20.3.6 The "QualifiedName" is defined in 29.3.2.
20.3.7 The "ExtendedXMLValue" is defined in 17.4.
20.3.8 The "AttributeName" shall be either the "identifier" of the component that has this final encoding instruction
or, if there are final NAME or NAMESPACE encoding instructions, the "QualifiedOrUnqualifiedName" determined by those
encoding instructions as specified in clauses 28 and 29.
20.3.9 The "CharacterEncodableValue" in the "QuotedValue" of the attribute (see 20.3.3) shall be the
"ExtendedXMLValue" of this type, possibly modified as specified in 20.3.12 to 20.3.15.
20.3.10 The order in which "Attribute"s appear in an "AttributeList" is an encoder's option, whether these are
generated by this encoding instruction or by the ANY-ATTRIBUTES encoding instruction.
NOTE – No semantics can be placed on the order of attributes in any EXTENDED-XER encoding. This restriction is required by
W3C XML 1.0, 3.1.
20.3.11 When an "AttributeList" in an instance of an encoding contains multiple attributes, then for any two
"Attribute"s in the list:
a) if the "AttributeName"s of the two attributes are both unqualified names, then they shall be different;
b) if the "AttributeName"s of the two attributes are both namespace-qualified names, then they shall either
have different namespace names, or shall be different names in the same namespace.
It is an illegal use of encoding instructions if this condition is violated by the application of final encoding instructions
for any abstract value of the top-level type that is being encoded.
20.3.12 If the "QuotedValue" is a "DoubleQuotedValue", and the "ExtendedXMLValue" in the
"CharacterEncodableValue" contains a QUOTATION MARK (34) character, then that character shall be replaced by
the characters:
"
or, as an encoder's option, by an escape sequence of the form &#n; or &#xn;, specified in Rec. ITU-T X.680 | ISO/IEC
8824- 1, 12.15.8.
20.3.13 If the "QuotedValue" is a "SingleQuotedValue" and the "ExtendedXMLValue" in the
"CharacterEncodableValue" contains an APOSTROPHE (39) character, then that character shall be replaced by the
characters:
'
or, as an encoder's option, by an escape sequence of the form &#n; or &#xn;, specified in Rec. ITU-T X.680 | ISO/IEC
8824- 1, 12.15.8.
20.3.14 The "ExtendedXMLValue" in the "CharacterEncodableValue" shall be one of the encodings of the character-
encodable type that does not contain XML tags.
20.3.15 If the "ExtendedXMLValue" contains HORIZONTAL TABULATION (9), LINE FEED (10), or CARRIAGE
RETURN (13) characters, then these characters shall be replaced in the "ExtendedXMLValue" by escape sequences of
the form "&#n;" or "&#xn;" specified in Rec. ITU-T X.680 | ISO/IEC 8824- 1, 12.15.8.
21.1 General
21.1.1 The "Base64Instruction" is:
Base64Instruction ::=
BASE64 TargetList
| BASE64 "]" TargetList
21.1.2 The "TargetList" production is defined in 14.2.
21.1.3 This encoding instruction can be assigned to an OCTET STRING, to an open type or to any restricted character
string type.
21.1.4 Application of this final encoding instruction to an octet string type or an open type removes the option of a
hexadecimal encoding, but allows the option of a Base64 encoding (as specified in IETF RFC 2045, 6.8). Application
of this final encoding instruction to a restricted character string type requires that the value of the restricted character
string type be encoded as a Base64 encoding.
21.2 Restrictions
21.2.1 If the final encoding instructions for an ASN.1 type contain a BASE64 encoding instruction then the type shall
be:
a) an OCTET STRING; or
b) an open type; or
c) a restricted character string type.
21.2.2 A type with this final encoding instruction shall not have any of the final encoding instructions ANY-ELEMENT
or WHITESPACE.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, DECIMAL, EMBED-VALUES, LIST, TEXT, USE-NIL, USE-NUMBER, USE-
ORDER, USE-QNAME, USE-TYPE, USE-UNION.
The "XMLRestrictedCharacterStringValue" shall be the Content-Transfer-Encoding specified in IETF RFC 2045, 6.8,
except that the 76-character limit does not apply, and "white-space with escapes" (see 8.1.5) is allowed in any position
within the "XMLBase64String".
NOTE – IETF RFC 2045 mandates the presence of line breaks dividing the encoding into lines of at most 76 characters, but this
is not required in EXTENDED-XER encodings. It also allows "white-space" to be inserted in any position within the base64
encoding.
21.3.7 If applied to a restricted character string type, then each character in the character string shall be encoded with
UTF-8 (see ISO 10646, Annex D). The resulting octets for the entire character string shall then be encoded into
characters as specified in IETF RFC 2045, 6.8, and the resulting characters shall form the "ExtendedXMLValue".
22.1 General
22.1.1 The "DecimalInstruction" is:
DecimalInstruction ::=
DECIMAL TargetList
| DECIMAL "]" TargetList
22.1.2 The "TargetList" production is defined in 14.2.
22.1.3 The purpose of this encoding instruction is to modify the encoding of a real type so that the exponential
notation is forbidden and a hyphen followed by "0" denotes the value plus zero instead of the value minus zero.
NOTE – The value minus zero cannot be represented.
22.2 Restrictions
22.2.1 This encoding instruction shall only be assigned to a real type.
22.2.2 The real type to which this encoding instruction is applied shall be restricted in such a way that the values
minus zero, MINUS-INFINITY, PLUS-INFINITY, and NOT-A-NUMBER are not permitted and the base is 10.
NOTE – It is recommended that this be done by applying the following constraints:
(WITH COMPONENTS {..., base(10)})
22.2.3 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
22.2.4 A type with this final encoding instruction can have any other final encoding instructions permitted for that
type.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES,
ANY-ATTRIBUTES ANY-ELEMENT,
ANY-ELEMENT BASE64,BASE64 EMBED-VALUES,
EMBED-VALUES LIST, LIST TEXT,
TEXT
USE-NIL,
USE-NIL USE-NUMBER,
USE-NUMBER USE-ORDER,
USE-ORDER USE-QNAME,
USE-QNAME USE-TYPE,
USE-TYPE USE-UNION,
USE-UNION WHITESPACE.
WHITESPACE
22.2.5 There shall be no qualifying information in the "TargetList".
22.3.2 The real value plus zero can be encoded, as an encoder's option, as "XMLDecimalMinusZeroRealValue",
defined as follows:
XMLDecimalMinusZeroRealValue ::=
"-" & modifiedXMLRealNumber
where the "modifiedXMLRealNumber" is restricted by 22.3.1 and contains no digits except the digit zero.
NOTE – The above cannot be confused with the real value minus zero, because the value minus zero is removed by the
mandatory restriction that applies to the real type (see 22.2.2).
23.1 General
23.1.1 The "DefaultForEmptyInstruction" is:
DefaultForEmptyInstruction::=
DEFAULT-FOR-EMPTY TargetList AS Value
| DEFAULT-FOR-EMPTY AS Value "]" TargetList
23.1.2 The "TargetList" production is defined in 14.2.
23.1.3 This encoding instruction specifies an abstract value that can be encoded in an EXTENDED-XER encoding
(as an encoder's option) as the "empty" alternative of "ExtendedXMLValue" for a type (see 17.4) that is encoded as the
sole content of an XML element.
NOTE – This defaulting mechanism supports the presence of an XML element with no content (typically, but not necessarily,
encoded as an empty-element tag). It is distinct from the use of ASN.1 DEFAULT, which relates to the absence of the
"ExtendedXMLNamedValue" of a component of a sequence or set.
23.1.4 The "TargetList" shall not use the keyword ALL and shall identify a single target.
23.1.5 There are five distinct cases where this encoding instruction can be used, identified below.
23.1.5.1 The first case is when it is assigned directly to a character-encodable type that is not UNTAGGED (see
clause 32). If the enclosing element has empty content, then that empty content represents the specified "Value" of the
character-encodable type (which is the governor for "Value").
23.1.5.2 The second case is when it is assigned to a (NOT UNTAGGED, NOT EMBED-VALUES and NOT USE-NIL) sequence
type that contains an UNTAGGED character-encodable component whose encoding forms the sole content (for all
abstract values of the sequence type) of the enclosing element of the sequence type. If the enclosing element of the
sequence type has empty content, then that empty content represents the specified "Value" of the character-encodable
component (which is the governor for "Value").
NOTE – The character-encodable component may be the sole content because it is the only component, or it may be the sole
content because all other components have a final ATTRIBUTE (see clause 20) or ANY-ATTRIBUTES (see clause 18) encoding
instruction.
23.1.5.3 The third case is when it is assigned to a (NOT UNTAGGED and NOT USE-NIL) sequence type with a final
EMBED-VALUES encoding instruction (see 25.3.1.4). If the enclosing element of the sequence type has empty content,
then that empty content represents an abstract value of the sequence type that would otherwise produce content that is
solely the specified "Value" of a sole UTF8String in the EMBED-VALUES sequence-of (UTF8String is the governor for
"Value").
23.1.5.4 The fourth case is when it is assigned to a (NOT UNTAGGED, NOT EMBED-VALUES) sequence type with a final
USE-NIL encoding instruction (see clause 33) whose OPTIONAL component is a character-encodable type. If the
enclosing element of the sequence type has a nil identification attribute with value true, the DEFAULT-FOR-EMPTY does
not affect the meaning of the encoding. If the enclosing element of the sequence type has a nil identification attribute
with value false (or has no nil identification attribute), and has empty content, then that empty content represents the
specified "Value" of the OPTIONAL component (whose type is the governor for "Value").
23.1.5.5 The fifth case is when it is assigned to a (NOT UNTAGGED) sequence type with a final EMBED-VALUES
encoding instruction (see 25.3.1.4) and a final USE-NIL encoding instruction (see clause 33) whose OPTIONAL
component is a sequence type. If the enclosing element of the sequence type has a nil identification attribute with value
true, the DEFAULT-FOR-EMPTY does not affect the meaning of the encoding. If the enclosing element of the sequence
type has a nil identification attribute with value false (or has no nil identification attribute), and has empty content,
then that empty content represents an abstract value of the sequence type that would otherwise produce content that is
solely the specified "Value" of a sole UTF8String in the EMBED-VALUES sequence-of (the UTF8String is the governor
for "Value").
23.1.6 "Value" is defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, 17.7.
NOTE – This permits use of a value reference defined in or imported into the module. The value reference can be defined using
XML Value Notation, but such notation cannot be used directly in "DefaultForEmptyInstruction".
23.2 Restrictions
23.2.1 If the final encoding instructions for an ASN.1 type that is a NOT UNTAGGED character-encodable type contain
a DEFAULT-FOR-EMPTY encoding instruction, then that type shall not be a component (of an ASN.1 SEQUENCE or SET)
SET)
with an ASN.1 DEFAULT value.
NOTE – This restriction is not strictly necessary, but is imposed to avoid confusion between the normal ASN.1 and the
EXTENDED-XER defaulting mechanisms.
23.2.3 If 23.2.2 a) applies, and "empty" is a valid "ExtendedXMLValue" for one of the abstract values (V, say) of the
(possibly constrained) type, and V is different from the "Value" in the "DefaultForEmptyInstruction", then there shall
be at least one alternative encoding for V.
23.2.4 If 23.2.2 b) or d) applies, and "empty" is a valid "ExtendedXMLValue" for one of the abstract values (V, say)
of the UNTAGGED component (case b)) or of the OPTIONAL component, (case d)), and V is different from the "Value"
in the "DefaultForEmptyInstruction", then there shall be at least one alternative encoding for V.
NOTE – It is recognized that some ASN.1 tools may not be able to statically check that the above restrictions will be satisfied for
all abstract values, but conforming encoders cannot generate encodings in which the "ExtendedXMLValue" violates this
restriction.
23.2.5 If 23.2.2 c) applies, the SEQUENCE type shall be constrained so that (without DEFAULT-FOR-EMPTY) there is no
abstract value that would produce an empty content for the enclosing element.
23.2.6 If a character-encodable type (case 23.2.2 a)) with this final encoding instruction has an enclosing type that is
a sequence-of or set-of type with a final LIST encoding instruction, or that is a choice type with a USE-UNION encoding
instruction, then this final encoding instruction shall be ignored.
23.2.7 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
23.2.8 A type with this final encoding instruction shall not have any of the final encoding instructions ANY-
ELEMENT, ATTRIBUTE or UNTAGGED.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, USE-TYPE.
23.3.3 If 23.2.2 a) applies, and "empty" is a valid "ExtendedXMLValue" for one of the abstract values (V, say) of the
type, and V is different from the "Value" specified in the "DefaultForEmptyInstruction", then any one of the alternative
encodings for V shall be used (as an encoder's option) instead of "empty".
23.3.4 If 23.2.2 b) or d) applies, and "empty" is a valid "ExtendedXMLValue" for one of the abstract values (V, say)
of the UNTAGGED component (case b)) or of the OPTIONAL component (case d)), and V is different from the "Value"
specified in the "DefaultForEmptyInstruction", then any one of the alternative encodings for V shall be used (as an
encoder's option) instead of "empty".
23.3.5 If 23.2.2 c) applies, the effect of this encoding instruction is specified in 25.3.1.4 and 25.3.1.5.
23.3.6 If 23.2.2 e) applies, the effect of this encoding instruction is specified in 25.3.1.6.
24.1 General
24.1.1 The "ElementInstruction" is:
ElementInstruction ::=
ELEMENT TargetList
| ELEMENT "]" TargetList
24.1.2 The "TargetList" production is defined in 14.2.
24.1.3 This encoding instruction is synonymous with NOT UNTAGGED, and does not imply any semantics other than
NOT UNTAGGED.
24.2 Restrictions
24.2.1 There shall be no qualifying information in the "TargetList".
24.2.2 This encoding instruction should not be used as a prefixed encoding instruction in combination with any of
the prefixed encoding instructions ANY-ATTRIBUTES, ANY-ELEMENT or ATTRIBUTE to avoid confusing the reader.
25.1 General
25.1.1 The "EmbedValuesInstruction" is:
EmbedValuesInstruction ::=
EMBED-VALUES TargetList
| EMBED-VALUES "]" TargetList
25.1.2 The "TargetList" production is defined in 14.2.
25.1.3 This encoding instruction enables the first component of a (NOT UNTAGGED) sequence type to provide
character strings to be inserted before the first XML element, after the last XML element, and between the XML
elements, that form the "ExtendedXMLValue" encoding of the sequence type.
25.1.4 If a final USE-NIL encoding instruction is also present, and the OPTIONAL component supporting USE-NIL is
absent in a particular abstract value, then there will be no XML elements for components of the sequence type, and no
character string are provided for that abstract value. Otherwise, for all abstract values, the number of character strings
provided is required to be equal to one greater than the number of elements in the encoding of the sequence type. Some
or all of the character strings may be empty.
25.2 Restrictions
25.2.1 An ASN.1 type shall not have this final encoding instruction unless it is a sequence type. The first component
of the sequence shall not be marked OPTIONAL or DEFAULT, and shall be a sequence-of type whose component is a
UTF8String with a constraint that forbids control characters.
25.2.2 There shall be no final UNTAGGED encoding instruction (see clause 32) on either the sequence-of type or on
the component of the sequence-of.
25.2.3 There shall be no final UNTAGGED encoding instruction on any component of the sequence type that is a
character-encodable type.
25.2.4 If the sequence type also has a final USE-NIL encoding instruction, the OPTIONAL component supporting the
USE-NIL encoding instruction shall not be a character-encodable type (see also 33.2.4).
25.2.5 None of the components of the sequence shall be marked DEFAULT unless they have a final ATTRIBUTE
encoding instruction. If there are components of a SEQUENCE or SET type (at any depth) that, through the use of
UNTAGGED, can produce elements in the "ExtendedXMLValue" that are immediate child elements of the sequence type,
these shall not be marked DEFAULT.
25.2.6 The sequence type shall be restricted in such a way that:
a) if the type has also a final USE-NIL encoding instruction and the OPTIONAL component supporting
USE-NIL is absent, the number of repetitions of the sequence-of component is required to be zero;
b) otherwise, the number of repetitions of the sequence-of component in every abstract value equals one
plus the number of XML elements in the "ExtendedXMLValue" of the sequence type, determined after
application of all final encoding instructions to the other components of the sequence, and ignoring the
first component.
NOTE – It is recommended that the constraint on the sequence type be expressed as:
(CONSTRAINED BY
{/* Shall conform to Rec. ITU-T X.693 | ISO/IEC 8825-4, clause 25 */})
25.2.7 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
25.2.8 A type with this final encoding instruction shall not have a final UNTAGGED encoding instruction.
NOTE – The following final encoding instructions can never occur together with this encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, ATTRIBUTE, BASE64, DECIMAL, LIST, TEXT, USE-
NUMBER, USE-QNAME, USE-TYPE, USE-UNION, WHITESPACE.
25.3.1.1 The first UTF8String value in the sequence-of shall be inserted (subject to 25.3.1.6) at the beginning of the
partial encoding, before the start-tag of the first XML element (if any).
25.3.1.2 Each successive UTF8String value (if any) shall be inserted between the end-tag of an XML element and the
start-tag of the following XML element, proceeding from the first element to the last element.
NOTE – The above implies that no UTF8String value is inserted inside any of these elements, even if they have child elements.
25.3.1.3 The last UTF8String value (if there is one) shall be inserted at the end of the partial encoding, after the end-
tag of the last XML element.
25.3.1.4 If no XML elements are present in the partial encoding, and there is also a final DEFAULT-FOR-EMPTY
encoding instruction (see clause 23) on the sequence type, and the value of the first (and only) UTF8String in the
sequence-of is identical to the "Value" specified in the DEFAULT-FOR-EMPTY encoding instruction, an encoder can
optionally encode the UTF8String as an empty string (but see 25.3.1.6).
25.3.1.5 If no XML elements are present in the partial encoding, and there is also a final DEFAULT-FOR-EMPTY
encoding instruction on the sequence type, and the encoding is empty, a decoder shall interpret it as an encoding for the
"Value" specified in the DEFAULT-FOR-EMPTY encoding instruction and assign this abstract value to the first (and only)
UTF8String in the sequence-of (but see 25.3.1.6).
NOTE – This means that a value with no XML elements present and with a single empty UTF8String value cannot be encoded.
The sequence type is required to be constrained to prohibit such values (see 23.2.5).
25.3.1.6 If the type also has a final USE-NIL encoding instruction and the OPTIONAL component is absent, then the
EMBED-VALUES encoding instruction has no effect. If the type also has a final USE-NIL encoding instruction and the
OPTIONAL component is present, then 25.3.1.4 applies. If a decoder determines that the OPTIONAL component is
present, by the absence of a nil identification attribute (or its presence with the value false), then 25.3.1.5 applies.
26.1 General
26.1.1 The "GlobalDefaultsInstruction" is:
GlobalDefaultsInstruction ::=
GLOBAL-DEFAULTS TargetList DefaultSetting
| GLOBAL-DEFAULTS DefaultSetting "]" TargetList
DefaultSetting ::=
ControlNamespace
| MODIFIED-ENCODINGS
ControlNamespace ::=
CONTROL-NAMESPACE
QuotedURI
Prefix ?
26.1.2 The "TargetList" production is defined in 14.2, and shall be "empty".
26.1.3 "QuotedURI" and "Prefix" are defined in 29.1.1.
26.1.4 The "ControlNamespace" production specifies the name of the control namespace (the "URI" in the
"QuotedURI"), and a recommended prefix for that namespace. If this GLOBAL-DEFAULTS encoding instruction is not
present, the control namespace shall be that specified in 16.9.
26.1.5 The use of MODIFIED-ENCODINGS produces "ExtendedXMLValues" that are modified in accordance
with 10.2.7 and 10.2.8.
26.2 Restrictions
26.2.1 The GLOBAL-DEFAULTS encoding instruction shall be assigned only in an XER encoding control section and
shall not be preceded by any other encoding instructions except other GLOBAL-DEFAULTS encoding instructions.
26.2.2 Each of the alternatives of GLOBAL-DEFAULTS shall be used at most once in any XER encoding control
section.
26.2.3 The GLOBAL-DEFAULTS MODIFIED-ENCODINGS, if present, shall be the first encoding instruction in the XER
encoding control section in an ASN.1 module.
27.1 General
27.1.1 The "ListInstruction" is:
ListInstruction ::=
LIST TargetList
| LIST "]" TargetList
27.1.2 The "TargetList" production is defined in 14.2.
27.2 Restrictions
27.2.1 The type to which this encoding instruction is assigned shall be a sequence-of or a set-of type.
27.2.2 The component of the sequence-of or set-of type:
a) shall be a character-encodable type; and
b) shall be such that, for all of its abstract values, there is at least one "ExtendedXMLValue" encoding
(taking account of all encoder's options) that is not "empty" and that does not contain "white-space with
escapes" (see 8.1.5).
NOTE 1 – The above restrictions imply that the component cannot itself be a sequence-of or set-of type with a LIST encoding
instruction, or contain a nested sequence-of or set-of type with a LIST encoding instruction at any depth.
NOTE 2 – The above restrictions will be satisfied if the type of the component of the sequence-of or set-of is the integer type,
real type, object identifier type, relative object identifier type, or the GeneralizedTime and UTCTime useful types. They will
also be satisfied if it is a character string type constrained so that it always has at least one character in the character string and
none of its values contains a "white-space" character.
NOTE 3 – It is recognized that some ASN.1 tools may not be able to statically check that the above rules are satisfied, but a
conforming encoder shall not generate encodings that violate b) above.
27.2.3 A type with this final encoding instruction shall not have a final ANY-ATTRIBUTES encoding instruction.
NOTE – The following final encoding instructions can never occur together with this encoding instruction because their
application to the type is forbidden: ANY-ELEMENT, BASE64, DECIMAL, EMBED-VALUES, TEXT, USE-NIL, USE-NUMBER, USE-
ORDER, USE-QNAME, USE-TYPE, USE-UNION, WHITESPACE.
28.1 General
28.1.1 The "NameInstruction" is:
NameInstruction ::=
NAME TargetList AS NewNameOrKeyword
| NAME AS NewNameOrKeyword "]" TargetList
NewNameOrKeyword ::=
NewName
| Keyword
NewName ::=
RestrictedCharacterStringValue
Keyword ::=
CAPITALIZED
| UNCAPITALIZED
| UPPERCASED
| LOWERCASED
28.1.4 The "RestrictedCharacterStringValue" is defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 41.
28.2 Restrictions
28.2.1 "NewName" shall not be used if the "QualifyingInformation" is ALL.
28.2.2 The NAME encoding instruction with "QualifyingInformation" shall only be assigned to the following type
definitions:
a) a boolean type definition; or
b) a bitstring type definition with named bits; or
c) an enumerated type definition; or
d) an integer type definition with named numbers.
28.2.3 The "RestrictedCharacterStringValue" in "NewName" when used in the NAME encoding instruction shall be
either an "NCName" defined in W3C XML Namespaces, clause 2, production 4, or an empty character string. It shall
not be an empty character string unless the NAME encoding instruction is applied to an alternative of a choice type with a
final USE-UNION encoding instruction.
NOTE 1 – It is a requirement in W3C XML Namespaces that an "NCName" does not commence with characters that when
uppercased are "XML".
NOTE 2 – The "NewNameOrKeyword" production (and hence the "NewName" production) is also used in clause 31. The above
restrictions on "RestrictedCharacterStringValue" do not apply to the use in clause 31.
28.2.4 If there is a GLOBAL-DEFAULTS encoding instruction with a MODIFIED-ENCODINGS keyword, there shall be
no "QualifyingInformation" in the "TargetList".
NOTE – This is because empty-element tags are not used in this case. The TEXT encoding instruction can instead be used to
change the encoding of the individual values of a type.
28.2.5 This encoding instruction should not be used, as a prefixed encoding instruction in combination with any of
the prefixed encoding instructions ANY-ATTRIBUTES, ANY-ELEMENT or UNTAGGED to avoid confusing the reader.
29.1 General
29.1.1 The "NamespaceInstruction" is:
NamespaceInstruction ::=
NAMESPACE TargetList NamespaceSpecification ?
| NAMESPACE NamespaceSpecification ? "]" TargetList
NamespaceSpecification ::=
AS
QuotedURI
Prefix ?
Prefix ::=
PREFIX
QuotedNCName
QuotedURI ::=
""" & URI & """
QuotedNCName ::=
""" & NCName & """
29.1.2 The "TargetList" production is defined in 14.2.
NOTE – The most common use of this encoding instruction is NAMESPACE ALL.
29.1.3 This encoding instruction enables a namespace name and recommended namespace prefix to be assigned to
the target(s).
29.1.4 The "URI" production is not defined in this Recommendation | International Standard, but consists of
characters that identify a Uniform Resource Identifier (URI). The syntax (and semantics) of a URI is defined in IETF
RFC 2396, and commences with the name of a URI scheme. For allocations of namespace names with the NAMESPACE
encoding instruction, any URI scheme can be used.
NOTE – Attention is drawn to the "oid" scheme for IETF URIs and IRIs based on the Internationalized Object Identifier tree (see
Annex F of Rec. ITU-T X.660 | ISO/IEC 9834-1).
29.1.5 If the "NamespaceSpecification" is absent, then a default is assigned with the recommended "Prefix" set to the
"modulereference" and the "URI" set as follows:
a) the URI scheme (see IETF RFC 2396) shall be urn;
b) the URN namespace identifier (see IETF RFC 2141) shall be oid;
c) the URN Namespace Specific String (see IETF RFC 2141) shall be the "DefinitiveIdentifier" of the
module expressed as an "XMLObjectIdentifierValue" (see IETF RFC 3061).
The "DefinitiveIdentifier" for the module is defined as:
DefinitiveIdentifier ::=
"{" DefinitiveObjIdComponentList "}"
| empty
29.1.6 EXAMPLE: With an object identifier value of {joint-iso-itu-t example(999) modules(0)
basic(1)} the "URI" would be the character string "urn:oid:2.999.0.1".
"urn:oid:2.999.0.1".
29.1.7 The "NCName" production is defined in W3C XML Namespaces, clause 2, production 4, and shall not
commence with characters that when uppercased are "XML".
NOTE – This is a requirement imposed by W3C XML Namespaces.
29.2 Restrictions
29.2.1 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
29.2.2 An ASN.1 type shall not have both a final ATTRIBUTE encoding instruction and a final NAMESPACE encoding
instruction specifying the control namespace.
a) the use of the "PrefixedName" alternative for "QualifiedName" with the addition to XML elements of
further attributes providing namespace declarations (as specified in W3C XML Namespaces); or
b) the use of the "UnprefixedName" alternative for "QualifiedName" with the addition to XML elements of
further attributes providing default namespace declarations (as specified in W3C XML Namespaces).
29.3.4 The choice of these two mechanisms and the XML elements to which the namespace declaration attributes are
added are an encoder's option.
NOTE 1 – W3C XML Namespaces specifies that a default namespace declaration has in its scope only the name of the element
in which it is declared (and of child element names), but not of attributes on that element or child elements.
NOTE 2 – It is recommended, but not required, that the recommended prefix in the NAMESPACE encoding instruction be used.
NOTE 3 – Use of the recommended prefix may be inappropriate if NAMESPACE encoding instructions with different namespace
names but the same recommended prefix are present in the module.
30.1 General
30.1.1 The "PIOrCommentInstruction" is:
PiOrCommentInstruction ::=
PI-OR-COMMENT TargetList AS RestrictedCharacterStringValue Position
| PI-OR-COMMENT AS RestrictedCharacterStringValue Position "]" TargetList
Position ::=
BEFORE-TAG
| BEFORE-VALUE
| AFTER-VALUE
| AFTER-TAG
30.1.2 The "TargetList" production is defined in 14.2.
30.1.3 This encoding instruction causes specified XML processing instructions and/or comments to be inserted
before or after the "ExtendedXMLValue" or before or after the associated tags.
NOTE – Subclause 10.2.5 permits an encoder (as an encoder's option) to insert additional XML processing instructions and XML
comments.
30.1.4 The "RestrictedCharacterStringValue" is defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 41.
30.2 Restrictions
30.2.1 The value of the "RestrictedCharacterStringValue" shall be the concatenation of one or more character strings
each of which conforms to the syntax of an XML Processing Instruction specified in W3C XML 1.0, 2.6, or to the
syntax of an XML Comment specified in W3C XML 1.0, 2.5, and defines the processing instructions and/or comments
that are to be inserted in the XML document.
30.2.2 An ASN.1 type shall not have both a final UNTAGGED encoding instruction and a final PI-OR-COMMENT
encoding instruction.
30.2.3 A type with this final encoding instruction shall not have any of the final encoding instructions ANY-
ATTRIBUTES, ANY-ELEMENT, ATTRIBUTE or UNTAGGED.
start-tag (using BEFORE-TAG on the corresponding type) shall follow these processing instructions and/or comments in
the XML document.
NOTE – In this case the contents of the associated tags is never empty, and the empty-element tag cannot be used.
30.3.3 If the "Position" is AFTER-VALUE, then the processing instructions and/or comments shall be inserted at the
end of the "ExtendedXMLValue". If that "ExtendedXMLValue" ends with a tag that is the associated end-tag of some
embedded "ExtendedXMLValue", then any processing instructions and/or comments inserted after that associated end-
tag (using AFTER-TAG on the corresponding type) shall precede these processing instructions and/or comment in the
XML document.
NOTE – In this case the contents of the associated tags is never empty, and the empty-element tag cannot be used.
30.3.4 If the "Position" is AFTER-TAG, then the processing instructions and/or comments shall be inserted after the
associated end-tag or empty-element tag. If that end-tag or empty-element tag is the end of some enclosing
"ExtendedXMLValue", then any processing instructions and/or comments shall be inserted after that
"ExtendedXMLvalue" (using AFTER-VALUE on the corresponding type) shall follow these processing instructions
and/or comments in the XML document.
31.1 General
31.1.1 The "TextInstruction" is:
TextInstruction ::=
TEXT TargetList TextToBeUsed ?
| TEXT TextToBeUsed ? "]" TargetList
TextToBeUsed ::=
AS
NewNameOrKeyword
31.1.2 The "TargetList" production is defined in 14.2.
31.1.3 The purpose of this encoding instruction is:
a) in the absence of GLOBAL-DEFAULTS MODIFIED-ENCODINGS, to enable values of boolean types,
enumerated types, bitstrings with named bits, and integers with named numbers, to be encoded as
character strings instead of empty-element tags;
b) in the presence of GLOBAL-DEFAULTS MODIFIED-ENCODINGS, to enable the character strings that are
used for the values of boolean types, enumerated types, bitstrings with named bits, and integers with
named numbers, to be changed.
31.1.4 The "NewNameOrKeyword" is defined in clause 28.
31.2 Restrictions
31.2.1 This encoding instruction shall only be assigned to the following types, with qualifying information
identifying one or more of the identifiers used in the definition of the type (or true or false for the boolean type):
a) a boolean type definition; or
b) a bitstring type definition with named bits; or
c) an enumerated type definition; or
d) an integer type definition with named numbers.
31.2.2 The final character strings used for the values of the type to which this encoding instruction is assigned shall
be distinct.
31.2.3 "NewName" in "NewNameOrKeyword" shall not be used if the "QualifyingInformation" is ALL. Subclause
28.2.3 does not apply to this use of "NewNameOrKeyword".
31.2.4 The "RestrictedCharacterStringValue" in "NewName" when used in the TEXT encoding instruction shall not
contain any control characters.
31.2.5 In the absence of a GLOBAL-DEFAULTS MODIFIED-ENCODINGS encoding instruction, the set of final TEXT
encoding instructions for a type shall not produce text encodings for some abstract values and empty element encodings
for other abstract values.
NOTE – If there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS encoding instruction, then all encodings are text encodings.
31.2.6 If the TEXT encoding instruction is applied to a bitstring type with named bits and "NewName" is used, the
"NewName" shall contain at least one character, shall not contain "white-space with escapes" (see 8.1.5), and shall not
commence with a "0" (DIGIT ZERO) or a "1" (DIGIT ONE).
31.2.7 A type with this final encoding instruction shall not also have a final USE-NUMBER encoding instruction.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, BASE64, DECIMAL, EMBED-VALUES, LIST, USE-NIL, USE-
ORDER, USE-QNAME, USE-TYPE, USE-UNION, WHITESPACE.
32.1 General
32.1.1 The "UntaggedInstruction" is:
UntaggedInstruction ::=
UNTAGGED TargetList
| UNTAGGED "]" TargetList
32.1.2 The "TargetList" production is defined in 14.2.
32.1.3 (Tutorial) An informal description of the effect of UNTAGGED on ASN.1 constructors is provided in Annex B.
This clause and its subclauses provide a tutorial introduction illustrating some of the effects of using UNTAGGED.
32.1.4 Used (possibly repeatedly and nested) in conjunction with sequence, set, choice, sequence-of, and set-of, it
enables an almost arbitrary pattern of XML elements to be specified. Its effect is to remove the XML start-tag that
precedes the "ExtendedXMLValue" of the "Type" to which it is applied and the XML end-tag that follows it, resulting
in the XML elements normally contained between those tags becoming partial XML content.
32.1.5 Applied to a choice type as a component of a sequence or set, it specifies the inclusion at that point in the
sequence (set) of exactly one of the alternatives of the choice type (or none if the choice type is an OPTIONAL
component). The identifier of the choice type does not appear in the encoding. Some alternatives of the choice type may
be XML elements, but others may be partial XML content containing an almost arbitrary pattern of multiple elements,
through use of UNTAGGED in the definition of those alternatives.
32.1.6 Applied to a sequence-of type as a component of a sequence or set, it specifies the inclusion at that point in
the sequence (set) of a specified or arbitrary number of repetitions of the sequence-of component (which may produce a
single XML element, or may produce partial XML content if it is itself UNTAGGED).
32.1.7 Applied to a sequence (or set) type or a sequence-of (or set-of) type as the alternative of a choice type, it
enables that alternative to consist of the partial XML content which is the "ExtendedXMLValue" of the sequence, set,
sequence-of or set-of.
32.1.8 A separate function of UNTAGGED when applied to a character-encodable type is to enable character content to
appear in the encoding of a sequence, with no tags around that content. This use is restricted to a component of a
sequence which is not itself untagged.
NOTE – The restriction is in order to simplify the rules needed to ensure easy and unambiguous decoding.
32.2 Restrictions
32.2.1 In all instances of use, the enclosing type shall be a sequence, set, choice, sequence-of, or set-of type. When
the enclosing type is a sequence, set, or choice type, it shall not contain an extension marker.
32.2.2 If the type is a character-encodable type, the enclosing type shall be a sequence type without a final
UNTAGGED encoding instruction. The type shall not be marked OPTIONAL or DEFAULT. All the other components of the
enclosing sequence type (if any) shall have a final ATTRIBUTE or ANY-ATTRIBUTES encoding instruction.
32.2.3 If the type is not a character-encodable type, it shall be a sequence, a set, a choice, a sequence-of, a set-of, an
octetstring or bitstring type with a contained "Type" without ENCODED BY, or an open type.
NOTE – Annex B provides guidelines that can ensure that ambiguities do not result from the use of this encoding instruction.
32.2.4 This encoding instruction shall not be applied to a type that has an empty "ExtendedXMLValue" encoding for
one of its abstract values, if the type is used as:
a) a component of a sequence or set type with OPTIONAL or DEFAULT; or
b) the component of a sequence-of or set-of type; or
c) an alternative of a choice type, if another alternative of the same choice type has an empty
"ExtendedXMLValue" encoding for one of its abstract values and has a final UNTAGGED encoding
instruction.
EXAMPLE: A type that is a sequence type with all of its components OPTIONAL has an abstract value with an empty
"ExtendedXMLValue" encoding, as does a sequence-of type where zero repetitions are allowed.
32.2.5 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
32.2.6 A type with this final encoding instruction shall not have any of the final encoding instructions ANY-
ATTRIBUTES, ANY-ELEMENT, ATTRIBUTE, DEFAULT-FOR-EMPTY, EMBED-VALUES, PI-OR-COMMENT, USE-NIL, USE-
ORDER or USE-TYPE.
32.3.3 If the enclosing type is a sequence or set type, the "ExtendedXMLNamedValue" (see 17.6) for this component
of the enclosed type shall be replaced by the "ExtendedXMLValue" of the component (the second alternative in the
"ExtendedXMLNamedValue" production).
NOTE – This "ExtendedXMLValue" may be a single XML element or may be partial XML content consisting of multiple XML
elements.
32.3.4 If the enclosing type is a sequence-of or set-of type, the "ExtendedXMLDelimitedItem" (if used – see 17.7) of
each repetition shall be replaced by the "ExtendedXMLValue" enclosed in the "ExtendedXMLDelimitedItem".
NOTE 1 – It is not possible to use UNTAGGED unless a GLOBAL-DEFAULTS of MODIFIED-ENCODINGS has been included in
the XER encoding control section, in which case "ExtendedXMLValueList" is not permitted (see 17.7.2).
NOTE 2 – This "ExtendedXMLValue" may be a single XML element or may be partial XML content consisting of multiple
XML elements.
32.3.5 If the type is an octetstring or bitstring type with a contained "Type" without ENCODED BY, or an open type,
the "ExtendedXMLValue" shall be an "ExtendedXMLTypedValue" (not an "xmlhstring" or an "XMLBase64String").
NOTE – Such types do not match the definition of character-encodable type (see 3.2.8). Subclause 32.3.5 implies that when they
have a final UNTAGGED encoding instruction, they are always encoded as XML elements.
33.1 General
33.1.1 The "UseNilInstruction" is:
UseNilInstruction ::=
USE-NIL TargetList
| USE-NIL "]" TargetList
33.1.2 The "TargetList" production is defined in 14.2.
33.1.3 This encoding instruction provides an optimized EXTENDED-XER encoding for a sequence with a single
OPTIONAL component whose other components (if any) all have a final ATTRIBUTE or ANY-ATTRIBUTES encoding
instruction, possibly preceded by an initial sequence-of type supporting USE-ORDER (see clause 35).
33.1.4 In the absence of this encoding instruction, the optional component would encode as follows:
a) (the "not missing but empty" case) if the component is present in the abstract value, with the abstract
value that has an empty "ExtendedXMLValue" encoding, an "ExtendedXMLNamedValue" for the
component is present in the XML document, usually as an empty-element tag (or with adjacent start and
end tags);
b) (the "missing" case) if the component is absent in the abstract value, the "ExtendedXMLNamedValue" is
not present;
c) (the "not missing and not empty" case) if the component is present in the abstract value with an abstract
value that does not have an empty encoding, an "ExtendedXMLNamedValue" for the component is
present with non-empty content.
33.1.5 Use of USE-NIL requires that the absence of the optional component (case b) above) be signalled by the
inclusion of a nil identification attribute with name "nil" and a value of either "true" or "1".
33.1.6 In cases a) and c) of 33.1.4, the nil identification attribute can either be omitted (as an encoder's option), or it
can be present with a value of either "false" or "0". The optional component shall be encoded by omitting the
associated tags.
33.2 Restrictions
33.2.1 The USE-NIL encoding instruction shall only be assigned to a sequence type that has an OPTIONAL
component without a final ATTRIBUTE encoding instruction. All the other components of the sequence type, if any,
shall have a final ATTRIBUTE or ANY-ATTRIBUTES encoding instruction, or shall be the sequence-of components
supporting a USE-ORDER or an EMBED-VALUES encoding instruction that are also final encoding instructions on the
sequence type.
33.2.2 The sequence type shall not have a final UNTAGGED encoding instruction.
33.2.3 The OPTIONAL component shall not have any of the final encoding instructions ANY-ELEMENT, ANY-
ATTRIBUTES, DEFAULT-FOR-EMPTY, EMBED-VALUES, PI-OR-COMMENT, UNTAGGED, USE-NIL, USE-ORDER or USE-
TYPE.
NOTE – Apart from UNTAGGED,
UNTAGGED the encoding instructions listed above are those that cannot be applied to a type that has a final
UNTAGGED encoding instruction.
33.2.4 If the OPTIONAL component is not a character-encodable type, then it shall be a sequence, set, choice,
sequence-of, set-of type, an open type, or an octetstring or bitstring type with a contained "Type" and without ENCODED
BY.
33.2.5 If the OPTIONAL component is a sequence type, none of its components shall have a final ATTRIBUTE or
ANY-ATTRIBUTES encoding instruction.
33.2.6 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
33.2.7 A type with this final encoding instruction shall not also have any of the final encoding instructions
UNTAGGED or USE-QNAME.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, ATTRIBUTE, BASE64, DECIMAL, LIST, TEXT, USE-
NUMBER, USE-TYPE, USE-UNION, WHITESPACE.
34.1 General
34.1.1 The "UseNumberInstruction" is:
UseNumberInstruction ::=
USE-NUMBER TargetList
| USE-NUMBER "]" TargetList
34.2 Restrictions
34.2.1 This encoding instruction shall be ignored unless it is applied to an enumerated type.
34.2.2 A type with this final encoding instruction shall not also have a final TEXT encoding instruction.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, BASE64, DECIMAL, EMBED-VALUES, LIST, USE-NIL, USE-
ORDER, USE-QNAME, USE-TYPE, USE-UNION, WHITESPACE.
35.1 General
35.1.1 The "UseOrderInstruction" is:
UseOrderInstruction ::=
USE-ORDER TargetList
| USE-ORDER "]" TargetList
35.2 Restrictions
35.2.1 This encoding instruction shall only be assigned to a sequence type that does not contain an extension marker.
The sequence type shall contain a component that is a sequence-of type (type A, say) with a component that is an
enumerated type. If the sequence type does not have also a final EMBED-VALUES encoding instruction, then type A shall
be the first component, otherwise it shall be the second component. If there is no final USE-NIL encoding instruction,
the sequence type shall also have at least one other component with no final ATTRIBUTE or ANY-ATTRIBUTES
encoding instruction (a non-attribute component). If there is a final USE-NIL encoding instruction, the OPTIONAL
component supporting the USE-NIL shall be a sequence type, and it shall have at least one component.
35.2.2 The enumerated type shall have identifiers that depend on the presence or absence of a final USE-NIL
encoding instruction on the sequence type with the USE-ORDER encoding instruction, as specified in the following
subclauses.
35.2.2.1 If there is no final USE-NIL encoding instruction, then the enumerated type shall have identifiers for the
enumerations that are in one-to-one correspondence (and are in the same textual order) with the identifiers of the
following non-attribute components (see 35.2.1) of the sequence. The sequence type shall be constrained so that every
abstract value of the sequence-of component contains exactly one identifier for each non-attribute component of the
sequence that is present in the abstract value.
35.2.2.2 If there is a final USE-NIL encoding instruction, then the enumerated type shall have identifiers for the
enumerations that are in one-to-one correspondence (and are in the same textual order) with the identifiers of the
components of the OPTIONAL component in the sequence type. The sequence type shall be constrained so that every
abstract value of the sequence-of component contains exactly one identifier for each component of the OPTIONAL
sequence that is present in the abstract value.
NOTE – It is recommended that the constraint on the sequence type be expressed as:
(CONSTRAINED BY {/* Shall conform to Rec. ITU-T X.693 | ISO/IEC 8825-4, clause 35 */})
35.2.2.3 The "EnumerationItem"s in the enumerations shall all be "identifier"s or shall all be "NamedNumber"s with
the value 0 for the first "EnumerationItem", 1 for the second, and so on, up to the last "EnumerationItem".
35.2.3 The sequence-of type shall not be marked OPTIONAL or DEFAULT.
35.2.4 The following components of the sequence (if there is no final USE-NIL encoding instruction), and the
components of the OPTIONAL sequence (if there is a final USE-NIL encoding instruction) shall not be marked DEFAULT
unless they have a final ATTRIBUTE encoding instruction.
35.2.5 No component of either the sequence with this final encoding instruction or the OPTIONAL sequence (when a
final USE-NIL encoding instruction is present) shall have a final UNTAGGED encoding instruction, whether the type of
that component is a character-encodable type or not, unless the type of that component is a choice type and none of its
alternatives has a final UNTAGGED encoding instruction.
35.2.6 No component of the sequence with this final encoding instruction shall have a final ANY-ELEMENT encoding
instruction.
35.2.7 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
35.2.8 A type with this final encoding instruction shall not also have a final UNTAGGED encoding instruction.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, ATTRIBUTE, BASE64, DECIMAL, LIST, TEXT, USE-
NUMBER, USE-QNAME, USE-TYPE, USE-UNION, WHITESPACE.
36.1 General
36.1.1 The "UseQNameInstruction" is:
UseQNameInstruction ::=
USE-QNAME TargetList
| USE-QNAME "]" TargetList
36.1.4 If the optional component is present in an abstract value of the sequence type, then that abstract value
represents a namespace-qualified name. If the optional component is absent, the sequence type represents an unqualified
name.
36.2 Restrictions
36.2.1 This encoding instruction shall only be assigned to a sequence with exactly two components, both of type
UTF8String. The first component shall be OPTIONAL.
36.2.2 The first component shall be restricted to represent a URI (see IETF RFC 2396). The second component shall
be restricted to contain an "NCName" as specified in W3C XML Namespaces, clause 2, production 4, and shall not
commence with characters that when uppercased are "XML".
36.2.3 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
36.2.4 A type with this final encoding instruction shall not also have a final USE-NIL encoding instruction.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, BASE64, DECIMAL, EMBED-VALUES, LIST, TEXT, USE-
NUMBER, USE-ORDER, USE-TYPE, USE-UNION, WHITESPACE.
37.1 General
37.1.1 The "UseTypeInstruction" is:
UseTypeInstruction ::=
USE-TYPE TargetList
| USE-TYPE "]" TargetList
37.1.2 The "TargetList" production is defined in 14.2.
37.1.3 This encoding instruction optimizes the EXTENDED-XER encoding of a choice type. It requires a type
identification attribute to be encoded in the enclosing element to identify the alternative that has been encoded (unless
this is the first alternative) and the removal of the start-tag and end-tag around the encoding of the alternatives.
37.1.4 The type identification attribute identifies the type of an XML element. The name of the attribute is required
to be the name "type" from the control namespace (see 16.9) and its value identifies an alternative of the choice type to
which this encoding instruction is applied (it provides alternative determination for the choice type).
37.2 Restrictions
37.2.1 The type to which USE-TYPE is assigned shall be a choice type without a final UNTAGGED encoding
instruction.
37.2.2 None of the alternatives of the choice type shall have a final UNTAGGED encoding instruction.
37.2.3 None of the alternatives of the choice type shall itself be a choice type with a final USE-TYPE encoding
instruction.
NOTE – One or more alternatives of the choice type may be choice types with a final USE-UNION encoding instruction.
37.2.4 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
37.2.5 A type with this final encoding instruction shall not also have any of the final encoding instructions
UNTAGGED or USE-UNION.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, ATTRIBUTE, BASE64, DECIMAL, DEFAULT-FOR-EMPTY,
EMBED-VALUES, LIST, TEXT, USE-NIL, USE-NUMBER, USE-ORDER, USE-QNAME, WHITESPACE.
38.1 General
38.1.1 The "UseUnionInstruction" is:
UseUnionInstruction ::=
USE-UNION TargetList
38.2 Restrictions
38.2.1 A type with a final encoding instruction of USE-UNION shall be a choice type.
38.2.2 All the alternatives of the choice type shall be character-encodable types, but shall not be choice types with a
final USE-UNION encoding instruction.
38.2.3 If the choice type has a final ATTRIBUTE or UNTAGGED encoding instruction or is used in a type definition as
a component of a sequence-of or set-of type with a final LIST encoding instruction, the alternatives of the choice type
shall be constrained so that, for any alternative, all its abstract values have at least one encoding (its
"ExtendedXMLValue") that is different from all the allowed encodings of all the textually-preceding alternatives.
NOTE – This requirement is imposed because it is impossible to insert a type-identification attribute determining the alternative
that was selected. Without this requirement, the encoding would be ambiguous.
38.2.4 In the following two subclauses, the term "identifier" means: identifier (possibly modified in accordance with
any final NAME and NAMESPACE encoding instructions) of an alternative (of the choice type).
38.2.5 If the choice type (type U, say) is being encoded as an alternative of an enclosing choice type (type E, say)
that has a final USE-TYPE encoding instruction, and the identifier of one of the alternatives of E is identical to the
identifier of one of the alternatives of U, then each abstract value of that alternative of U shall have at least one
encoding that is different from all the encodings of the textually-preceding alternatives of U.
NOTE – This requirement is imposed because in this case it is not possible to identify the alternative of U, as the identifier in a
type identification attribute for E would merely identify the whole of U.
38.2.6 If the choice type (U1, say) is being encoded as an alternative of an enclosing choice type (E, say) with a final
USE-TYPE encoding instruction, and E contains another choice type (U2, say) with a USE-UNION encoding instruction
that textually follows U1 in E, and the identifier of any one of the alternatives of U2 is identical to one of the identifiers
in U1, then each abstract value of that alternative of U2 shall have at least one encoding that is different from all the
encodings of all the alternatives of U1.
NOTE – This requirement is imposed because in this case it is not possible to identify the alternative of U2, as the identifier in a
type identification attribute for E would identify the alternative in U1.
38.2.7 This encoding instruction shall not be assigned unless there is a GLOBAL-DEFAULTS MODIFIED-ENCODINGS
encoding instruction in the XER encoding control section.
38.2.8 A type with this final encoding instruction shall not also have a final USE-TYPE encoding instruction.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, ANY-ELEMENT, BASE64, DECIMAL, EMBED-VALUES, LIST, TEXT, USE-
NIL, USE-NUMBER, USE-ORDER, USE-QNAME, WHITESPACE.
38.3.2 If every possible encoding of the abstract value being encoded is identical to one of the encodings of an
abstract value of a textually-preceding alternative, then a type identification attribute shall be added.
NOTE – This subclause 38.3.2 removes the encoder's option of subclause 38.3.1 and makes the addition of the type identification
attribute mandatory. The restrictions specified in 38.2.4 to 38.2.6 ensure that this can only occur when the choice type is encoded
as an element and when no ambiguity due to identical identifiers is possible.
38.3.3 If the choice type has a final ATTRIBUTE or UNTAGGED encoding instruction or its enclosing type is a
sequence-of or set-of type with a final LIST encoding instruction, no type identification attribute can be inserted in any
element. In the case of the scenarios described in 38.2.4 to 38.2.6, a type identification attribute cannot be inserted to
precisely identify some of the alternatives of U or U2. Decoders shall therefore rely on the conditions of 38.2.4 to 38.2.6
to determine the abstract value that has been encoded.
NOTE – These rules imply that a decoder is required, in the absence of a type identification (or in the presence of an ambiguous
one), to attempt to decode against the textually first alternative, then the next, and so on, accepting the first successful decode that
is found (or diagnosing an error if there is no successful decode).
38.3.4 The type identification attribute shall be an instance of the "Attribute" production (see 20.3.3) with a
namespace-qualified "ControlAttributeName" (see 20.3.5) of "type" from the control namespace (see 16.9).
38.3.5 The value of the type identification attribute shall be the identifier of the chosen alternative, possibly modified
in accordance with any final NAME and NAMESPACE encoding instructions.
38.3.6 All the "Attribute"s that would otherwise be in the "AttributeList" of the "ExtendedXMLChoiceValue" shall
be added to the "AttributeList" of the enclosing element and the "ExtendedXMLChoiceValue" of the choice type shall
be replaced by the "ExtendedXMLValue" in the "ExtendedXMLChoiceValue".
38.3.7 The "ExtendedXMLValue" of the character-encodable type shall be one of the encodings that does not
contain any XML tags.
NOTE – This may restrict encoders' options.
38.3.8 If an alternative of the choice type has a final NAME AS "" encoding instruction, no type identification
attribute shall be added for that alternative.
39.1 General
39.1.1 The "WhiteSpaceInstruction" is:
WhiteSpaceInstruction ::=
WHITESPACE TargetList WhiteSpaceAction
| WHITESPACE WhiteSpaceAction "]" TargetList
WhiteSpaceAction ::=
REPLACE
| COLLAPSE
39.1.2 The "TargetList" production is defined in 14.2.
39.1.3 This encoding instruction requires decoders to accept additional options in the encoding of the SPACE (32)
character and in the use of leading and trailing "white-space with escapes" (see 8.1.5) for character string encodings.
39.2 Restrictions
39.2.1 This encoding instruction can only be assigned to:
a) a restricted character string type that either does not contain, or is constrained not to contain the
following characters:
1) HORIZONTAL TABULATION (9);
2) LINE FEED (10);
3) CARRIAGE RETURN (13);
b) a type with a final TEXT encoding instruction whose "NewName" does not contain these characters.
39.2.2 If this encoding instruction has the COLLAPSE option, then it shall not be applied to a restricted character
string type unless that type is constrained not to have leading or trailing spaces or contain multiple adjacent spaces for
any abstract value.
NOTE – It is recognized that some ASN.1 tools may not be able to statically check that the above restriction will be satisfied for
all abstract values, but conforming encoders cannot generate encodings in which the "ExtendedXMLValue" violates this
restriction.
39.2.3 If this encoding instruction has the COLLAPSE option, then it shall not be applied to a type with a final TEXT
encoding instruction whose "NewName" has leading or trailing spaces or contains multiple adjacent spaces.
39.2.4 A type with this final encoding instruction shall not also have any of the final encoding instructions ANY-
ELEMENT or BASE64.
NOTE – The following final encoding instructions can never occur together with this final encoding instruction because their
application to the type is forbidden: ANY-ATTRIBUTES, DECIMAL, EMBED-VALUES, LIST, TEXT, USE-NIL, USE-NUMBER, USE-
ORDER, USE-QNAME, USE-TYPE, USE-UNION.
40.3 The following object identifier, OID internationalized resource identifier and object descriptor values are
assigned in order to identify the ASN.1 namespace (see 16.9):
asn1Namespace OBJECT IDENTIFIER ::=
{joint-iso-itu-t asn1 (1) xml-encoding (5) extended (2)
modules (0) support (1) }
"/ASN.1/XML-Encoding/Extended/Modules/Support"
NOTE – The IETF /IRI/URI corresponding to this value is
"oid:/ASN.1/XML-Encoding/Extended/Modules/Support"
"ASN.1 namespace for EXTENDED-XER support"
Annex A
This annex illustrates the use of the basic and canonical XML Encoding Rules specified in this Recommendation |
International Standard by showing XML Markup representations of a (hypothetical) personnel record which is defined
using ASN.1.
<PersonnelRecord>
<name>
<givenName>John</givenName>
<initial>P</initial>
<familyName>Smith</familyName>
</name>
<title>Director</title>
<number>51</number>
<dateOfHire>19710917</dateOfHire>
<nameOfSpouse>
<givenName>Mary</givenName>
<initial>T</initial>
<familyName>Smith</familyName>
</nameOfSpouse>
<children>
<ChildInformation>
<name>
<givenName>Ralph</givenName>
<initial>T</initial>
<familyName>Smith</familyName>
</name>
<dateOfBirth>19571111</dateOfBirth>
</ChildInformation>
<ChildInformation>
<name>
<givenName>Susan</givenName>
<initial>B</initial>
<familyName>Jones</familyName>
</name>
<dateOfBirth>19590717</dateOfBirth>
</ChildInformation>
</children>
</PersonnelRecord>
Annex B
B.1.1 The following subclauses describe the construction of partial XML element content. This clause describes
what partial XML element content is produced as part of encodings, and B.2 specifies restrictions on partial XML
element content that are necessary to satisfy the requirement of 10.2.11. If an ASN.1 specification with XER encoding
instructions does not violate these restrictions, it is a legal specification, and tools can easily check its legality. If the
restrictions are violated, the specification may still not violate the normative requirements of 10.2.11, but tools may
find it hard to check that this is the case.
NOTE – The restrictions are designed to ensure that a decoder can easily and unambiguously recover the abstract values that
were used by an encoder in the production of the encoding.
B.1.2 A partial XML element content is made up of a combination of single XML elements provided by an
[ELEMENT] SEQUENCE, SET, SEQUENCE OF, SET OF or CHOICE, and of other partial XML element content provided by
[UNTAGGED] SEQUENCE, SET, SEQUENCE OF, SET OF or CHOICE.
NOTE – The boundary between partial XML element content within a larger partial XML element content is not visible in the
encoding, but can be determined from the ASN.1 schema and restrictions on the names of elements.
B.2.2 For the purposes of this clause only, a requirement that element names be distinct should be interpreted as
follows:
a) all comparisons are made after the application of any final NAME and NAMESPACE encoding instructions
on the type that generated the name;
b) names that are namespace-qualified names are distinct from unqualified names;
c) namespace-qualified names are distinct if and only if they differ in either their unprefixed name or their
namespace name or both.
B.2.3 For any resulting partial XML element content, there is possible ambiguity (and hence a possible violation
of 10.2.11) if the conditions specified in this subclause B.2 are not satisfied for all possible choices of alternatives in an
alternatives group, for all possible exercise of optionality in a concatenation group, for all possible repetitions of a
repeated group, and for all possible ordering of the encodings of the components of a set.
NOTE – In reading and implementing the following clauses, the above text saying "for all possible" is very important.
Implementers of tools that determine what is an unambiguous specification and what is not will need to analyze all possible
combinations of choices, optionality, repetitions and ordering.
B.2.4 (Delimitation requirement) There should be no two adjacent partial XML element contents with the same
element name for the first element of the second partial XML element content and for the last element of the first partial
XML element content, unless the first partial XML element content is self-delimiting.
EXAMPLE 1: Partial XML element content produced by an [UNTAGGED] SEQUENCE is self-delimiting if it does not
end with an OPTIONAL element.
EXAMPLE 2: Partial XML element content produced by an [UNTAGGED] SEQUENCE OF is self-delimiting if it has a
fixed number of iterations, which themselves are self-delimiting. This means, inter alia, that SEQUENCE OF [UNTAGGED]
SEQUENCE OF INTEGER is ambiguous and violates 10.2.11 unless the number of repetitions of the second SEQUENCE OF is
fixed.
EXAMPLE 3: Partial XML element content produced by an [UNTAGGED] SET is never self-delimiting if it has any
optional elements.
B.2.5 (Alternative determination requirement) The first XML elements of the alternative partial XML element
content in an alternatives group should all have distinct element names.
NOTE – The above text ignores the possible use of USE-TYPE and USE-UNION, which are beyond the scope of this annex.
is not in fact an ambiguous EXTENDED-XER encoding (for a human decoder), but it violates the above requirement
and also violates 10.2.11. It is an illegal use of encoding instructions.
B.2.6 (Optionality determination requirement) The XML element names of the first XML element of all consecutive
optional partial XML element content plus that of the next following mandatory partial XML element content should be
distinct.
NOTE – This means, inter alia, that any optional partial XML element content at the end of a group that is being repeated and
any optional partial XML element content at its start have to have distinct XML element names unless the number of repetitions
is restricted to a maximum of 1. If the entire partial XML element content of the group that is being repeated is optional, then
their XML element names should all be distinct.
violates the optionality determination requirement and also violates 10.2.11. It is an illegal use of encoding instructions.
B.2.7 (Repetition count determination requirement) All repetition groups that have a number of repetitions that is
not fixed should be followed by a partial XML element content whose first XML element has a name that is distinct
from the name of the first XML element of the partial XML element content that is being repeated.
violates the repetition count determination requirement and also violates 10.2.11. It is an illegal use of encoding
instructions. Alternatively:
GoodExample1::= SEQUENCE {
required-items [UNTAGGED] SEQUENCE OF required-books Book ,
optional-items [UNTAGGED] SEQUENCE OF optional-books Book }
violates the component determination requirement and also violates 10.2.11. It is an illegal use of encoding instructions.
Alternatively:
GoodExample2::= SET {
uk-mailing [UNTAGGED] SEQUENCE {uk-name UTF8String, post-code UTF8String},
us-mailing [UNTAGGED] SEQUENCE {us-name UTF8String, zip-code UTF8String}}
Annex C
C.1 Introduction
C.1.1 This annex provides tutorial information and examples on the application of XER encoding instructions.
NOTE – All ASN.1 examples in this annex assume an environment of AUTOMATIC TAGS.
C.1.2 Encoding instructions normally need to be assigned to an ASN.1 specification only if the designer has a
requirement for the actual form of the XML encoding to match that defined by other schema specifications, or expected
by other XML tools. Otherwise, ASN.1 alone (with BASIC-XER or CXER encoding) can be used.
C.1.3 If ASN.1 is used as the schema definition notation, then additional use of encoding instructions will in general
provide more compact XML encodings than use of ASN.1 alone, but the encodings are still far more verbose than use
of ASN.1 with PER.
NOTE – The examples (and the identifiers and type names used) are designed to illustrate features of EXTENDED-XER, and do
not in general represent real-world specifications.
<BBCard>
<name>Jorge Posada</name>
<team>New York Yankees</team>
<age>29</age>
<position>C</position>
<handedness><right-handed/></handedness>
<batting-average>0.277</batting-average>
</BBCard>
C.2.2 An employee
<Employee>
<id>239</id>
<recruited>27-11-2002</recruited>
<salaries>
<salary>29876</salary>
<salary>54375</salary>
<salary>98435</salary>
</salaries>
</Employee>
<employee id = "239">
<recruited>27-11-2002</recruited>
<salaries>29876 54375 98435</salaries>
</employee>
ENCODING-CONTROL XER
NAME Employee AS UNCAPITALIZED
ATTRIBUTE Employee.id
LIST Employee.salaries
ENCODING-CONTROL XER
[NAME AS UNCAPITALIZED] Employee
[ATTRIBUTE] Employee.id
[LIST] Employee.salaries
<PrimeProducts>
<input><int2/><int7/><int17/><int23/><int29/><int3/></input>
<output>476338.00</output>
</PrimeProducts> -- BASIC-XER
<PrimeProducts input="2 7 17 23 29 3" output="476338.00"/>
-- EXTENDED-XER
<CallDetails>
<number>0164593746</number>
<response><number-not-known/></response>
</CallDetails> -- BASIC-XER
<CallDetails number="0164593746"/> -- EXTENDED-XER
<Notification>
Please note the following details:
<account>568903</account>
(your business account)
<amount-due>536</amount-due>
This is in excess of your normal monthly allowance
<payable-by>27-08-2003</payable-by>
or earlier
</Notification>