Generated XER Encode Functions (Old Style - Deprecated)

XER stands for “XML Encoding Rules”, a form of XML specified in the X.693 standard for use with ASN.1.

Note

As noted in the Overiew, the style of generated code that is discussed here is now deprecated. To upgrade to the new style, see the section below for some upgrade tips. The old-style XER encode functions can still be generated by specifying the -xer -compat 649 (or lower) switches on the command line. This ability may be removed in some future version of ASN1C, so you are encouraged to upgrade to the new style.

For each ASN.1 prouction defined in the ASN.1 source file, a C XER encode function is generated. This function will convert a populated C variable of the given type into an XER encoded ASN.1 message (i.e. an XML document).

If C++ code generation is specified, a control class is generated that contains an Encode method that wraps this function. This function is invoked through the class interface to encode an ASN.1 message into the variable referenced in the msgData component of the class.

Note that you may use the -xsd switch when generating XER encoders and decoders with -xer. The XML schema produced from the ASN.1 specification using the -xsd switch can be used to validate the XML messages generated using the XER encode functions. Similarly, an XML instance can be validated using the generated XML schema prior to decoding.