This section presents the new services and the improvements added to the XSD Tools for C v2.0 release with regards to the v1.1 release.
The
MARBEN™ XSD Tools for C v2.0 supports Extended XER (the ability to encode and decode XML values conformant to the XML schema
into ASN.1 binary format). Moreover, the v2.0 XSD Compiler generates XER encoding instructions in the ASN.1 output file. This v2.0 release
brings also several enhancements and bug fixes which are listed in the following sections.
- Extended-XER support
The MARBEN™ XSD Tools for C v2.0 supports Extended-XER, that is the ability to encode and decode XML values conformant to the input XML
schema (see amendment 1 to [X.693]).
The v2.0 XSD Compiler generates XER encoding instructions in the ASN.1 output file and the v2.0 XSD Runtime encompasses an Extended-XER encoder/decoder.
This new feature does not modify the C API.
- Double type usable on 32 bits platforms
To allow the double XML schema type to be used on 32 bits platforms, the
(-9007199254740991..9007199254740991) constraint on the mantissa has been removed from the generated ASN.1 file.
This is not strictly conforming to [X.694] but does not cause any compatibility problem with others [X.694] tools.
- New flush function for streams
A casnFlushStream function has been added to the C API. This function gives the ability to flush a stream.
- DATE_TIME and DURATION mapping
The corrigendum 1 to [X.694] has modified the names of the ASN.1 types corresponding to the dateTime and duration XML schema types. These names have been changed from DATE-TIME and DURATION to DATE-TIME-Type and DURATION-Type.
This change impacts the ASN.1 output file, and consequently the C API and the XER encoding (basic and canonical only). However, this will generally not break the inter-release compatibility because these names are usually only used through other names that have not changed.
- Substitution group mapping
This 2.0 version corrects the mapping of substitution groups on two points.
Firstly, in the v1.1 version, the fields of the CHOICE type mapped for the substitution group were not sorted by named as required by [X.694].
Example:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="xs:string" block="restriction">
<xsd:element name="before" substitutionGroup="root"/>
</xs:schema>
Part of v1.1 ASN.1 mapping :
Root-group ::= CHOICE { // wrong : fields are not sorted
root Root,
before Before
}
Part of v2.0 ASN.1 mapping :
Root-group ::= CHOICE { // good : fields are sorted
before Before,
root Root
}
Secondly, in the v1.1 version, in some cases, a reference to a head of substitution group was incorrectly mapped.
Example:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="uid"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uid" type="uidType"/>
<xs:element name="uid2" substitutionGroup="uid" type="uidType"/>
<xs:complexType name="uidType">
<xs:attribute name="val" type="xs:string"/>
</xs:complexType>
</xs:schema>
Part of v1.1 ASN.1 mapping :
Root ::= SEQUENCE {
uid Uid // wrong : head of substitution group
}
Part of v2.0 ASN.1 mapping :
Root ::= SEQUENCE { // good : fields are sorted
uid Uid-group // good : substitution group
}
Uid-group ::= CHOICE {
uid Uid,
uid2 Uid2,
}
These corrections impact the user application and all encodings.
- New customization points
To enhance the compatibility of the XSD runtime with various platforms, some new customization points have been added:
-
The new asnfilelength function is defined is the asccstz.c file. This function is used by the file streams to get
the length of a file. The default implementation of this function is system dependent because the use of fseek
and ftell to get the length of a binary file is no longer portable. The user should check it against its platform.
-
The default implementations of the functions (defined in the asccstz.c file) converting a floating-point value to and
from a string representation are now system dependent because of the limitations of some old platforms on the NaN,
-INF and INF special values. The user should check them against its platform.
-
The asnOFFSETOF macro defined in the ascupdef.h file uses now the standard offsetof definition provided in the standard
stddef.h file instead of defining it. This is because there is no portable way to define this macro.
-
The source code of the E-XER encoder and decoder can be removed from the runtime by undefining the new asnCodEXER
macro defined in the ascupdef.h file.