Home
ASN.1 Compiler Version 6.3 XSD User`s Manual Objective Systems
Contents
1. anOpenType TYPE IDENTIFIER amp Type Generated XSD type lt xsd complexType name SeqwithOpenType gt lt xsd sequence gt lt xsd any gt lt xsd sequence gt lt xsd complexType gt In this case any valid XML instance can be used in the type Note that the ASN 1 element name anOpenType is ignored If the open type is bound a by a relational table constraint and tables was specified on the com mand line an XSD choice is created that contains all of the possible types that may appear in the field This is further described in the section on mapping items from table constraints Tagged Type In ASN 1 it is possible to create new custom types using ASN 1 tag values as identifiers These identifiers are built into BER or DER encoded messages In general these tags have no meaning in 15 EXTERNAL and EmbeddedPDV Type an XSD representation of an ASN 1 type that is used to create or validate XML markup However if the schema definition is to be used to generate a BER or DER instance of a type the tag information will be required For this reason it is possible to add either non native attributes or an application information annotation appinfo to the generated XSD type describing the ASN 1 tags The annotation carries all of the information an application would need to know to encode a BER or DER message of the given type This includes the tag s class identifier number and how it is applie
2. an application that is encoding or decoding a message of the given type EXTERNAL and EmbeddedPDV Type The EXTERNAL and EmbeddedPDV types are built in ASN 1 types that make it possible to trans fer a value of a different encoding type within an ASN 1 message These are constructed types built 16 Elements with Table Constraints into the ASN 1 standard An XSD representation of each of these types is available in the asn1 xsd library The ASNIC compiler generates a reference to the types in the library when it encounters a reference to one of these types ASN 1 production TypeName EXTERNAL Generated XSD code lt xsd complexType name TypeName gt lt xsd complexContent gt lt xsd extension base asnl EXTERNAL gt lt xsd complexContent gt lt xsd complexType gt ASN 1 production TypeName EMBEDDED PDV Generated XSD code lt xsd complexType name TypeName gt lt xsd complexContent gt lt xsd extension base asnl EmbeddedPDV gt lt xsd complexContent gt lt xsd complexType gt Elements with Table Constraints The ITU T ASN 1 X 681 and X 682 standards specify a table driven approach for the assignment of constrained values to open types within a specification These constraints are known as table constraints and utilize Open Type Class Information Object and ObjectSet definitions Elements within types that are constrained in this way result in a spe
3. name before the element type name in a SEQUENCE OF definition This makes it possible to control the name of the element used in the generated XSD definition The mapping for this case 1s as follows ASN 1 production TypeName SEQUENCE OF elementName ElementTyp Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence maxOccurs unbounded gt lt xsd element name elementName type ElementType gt lt xsd sequence gt lt xsd complexType gt CHOICE The ASN 1 CHOICE type is used to specify a list of alternative elements from which a single element can be selected This type is mapped to the XSD choice complex type The mapping is as follows ASN 1 production TypeName CHOICE lement1 nam lement1l type lement2 nam lement2 type Generated XSD code lt xsd complexType name TypeName gt lt xsd choice gt lt xsd element name elementl name type elementl type gt lt xsd element name element2 name type element2 name gt lt xsd choice gt lt xsd complexType gt typedef struct This is similar to the SEQUENCE and SET cases described above The only difference is that xsd choice is used instead of xsd sequence or xsd all The CHOICE type cannot have elements marked as optional OPTIONAL or elements that contain default values DEFAULT as was the case for SEQUENCE and SET 14 Open Type If the CHOICE type is extensible 1 e co
4. sequence gt lt xsd complexType gt 20 XML Schema to ASN 1 Conversion The version 5 8 release of ASN1C contains a separate command line utility program that translates an XML Schema Definitions XSD source file into an equivalent ASN 1 source file This conver sion process is based on the ITU T X 694 standard which specifies a mapping from XSD to ASN 1 The mapping specified in the standard consists of two parts 1 A mapping of XSD elements types and attributes to equivalent ASN 1 items and 2 The addition of extended XER E XER annotations to allow the ASN 1 source file to act as a stand alone schema for use in both XML and ASN 1 applications The ASNIC translation process supports only the first item at this time The main goal of the translation process is to get the XML schema into a form that allows the generation of efficient binary encoders decoders that utilize the ASN 1 encoding rules Option 1 supports this goal by creating an ASN 1 file that can be used with any ASN 1 compiler product or tool that supports standard ASN 1 syntax It should also be noted that the translation process of going from ASN 1 to XSD described in the previous section is not round trippable with the XSD to ASN 1 process described in this section That is to say one cannot start with an XSD file for example and translate it to ASN 1 using this tool and then translate that file back to XSD and expect the final XSD file to be the same as
5. simpleType In this case the permitted alphabet character set charSet is converted into a corresponding pattern for use in the generated XML schema definition Time String Types The ASN 1 GeneralizedTime and UTCTime types are mapped to the XSD dateTime type ASN 1 production TypeName ASN1TimeStringType in this definition ASN TimeStringType would be replaced with either GeneralizedTime or UTC Time Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd dateTime gt lt xsd simpleType gt ENUMERATED The ASN 1 ENUMERATED type is converted into an XSD token type with enumeration items The enumeration items correspond to the enumerated identifiers in the type If the attrs enum command line option is specified and the enumerated items contain numbers i e do not follow the standards sequence then an asn value attribute is added to the type to allow an application to map the enumerated identifiers to numbers If an asn value attribute is not present then an application can safely assume that the enumerated identifiers are in sequential order starting at zero ASN 1 production TypeName ENUMERATED idl vall id2 val2 etc Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd token gt lt xsd enumeration name idl asnl value vall gt lt xsd enumeration name id2 asnl value val2 gt lt xsd restriction gt l
6. the original Certain naming conventions that are utilized make this type of round trip conversion process very problematic It is therefore a one way process a user must work either in XSD or ASN 1 and then use the tools to get an equivalent representation in the alternative form Running the XSD to ASN 1 Translation Tool from the Command line The XSD to ASN 1 translation tool is the xsd2asn utility program that can be found in the bin subdirectory of an ASNIC installation To test if the compiler was successfully installed enter xsd2asn1 with no parameters as follows note if you have not updated your PATH variable you will need to enter the full pathname xsd2asnl You should observe the following display or something similar XSD2ASN1 Version 0 2 x Copyright c 2005 Objective Systems Inc All Rights Reserved Usage xsd2asnl lt filename gt options 21 Running the XSD to ASN 1 Trans lation Tool from the Command line lt filename gt XML schema or WSDL source file name s Multiple filenames may be specified and wildcards are allowed options config lt file gt Specify schema bindings file o lt directory gt Output file directory I lt directory gt Import file directory all Compile all dependent files warnings Output compiler warning messages The XSD source file specification can be a full pathname or only what is necessary to qualify the file If directory information is not provid
7. O objective SYSTEMS INC ASNIC ASN 1 Compiler Version 6 3 XSD User s Manual Objective Systems Inc March 2010 The software described in this document is furnished under a license agreement and may be used only in accordance with the terms of this agreement Copyright Notice Copyright 1997 2010 Objective Systems Inc All rights reserved This document may be distributed in any form electronic or otherwise provided that it is distributed in its entirety and that the copyright and this notice are included Author s Contact Information Comments suggestions and inquiries regarding ASN1C may be submitted via electronic mail to info obj sys com Table of Contents Overview of ASN I XSD Translation e ai 1 Using the ASN2XSD command line tool 2 2 iii al itaaitiee 3 ASN 1 to XML Schema Conversion ii A A i e A A el bi 5 Mapping of Top Level Constructs aan a Be 5 Mapping Of ASNT Types 200 2er 5 BOOLEAN asa 6 INTEGER ass ne RER 6 BIT STRING odio 7 OETELSIRING rel 7 Character Stine Py pes o o at RS 8 Time Steme E o as 9 ENUMERADAS 9 NULES nar as 10 OBJECT IDENTIFIER es tdo 2000 10 RELATIVE GID vr A si OE 11 REA acid 11 SEQUENCE er a O ala ats 12 SET ee Neil 12 SEQUENCE DE FSET OR a ee nee 13 A a A een 14 Open Type a ins eet nan venga ans a eens 15 Tagged Type ars Eee nee 15 EXTERNAL and EmbeddedPDV Type el 16 Elements with Table Constraints a2 17 AMT Schemarto ASN T C nversie
8. SSAGE RadioLinkSetupRequestTDD SUCCESSFUL OUTCOME RadioLinkSetupResponseTDD UNSUCCESSFUL OUTCOME RadioLinkSetupFailureTDD MESSAGE DISCRIMINATOR common P C ROCEDURE ID procedureCode id radioLinkSetup ddMode tdd RITICALITY reject After working through the various layers ASN2XSD is able to produce an XSD definition that provides fixed type references for the procedurelD criticality and messageDiscriminator elements An anonymous choice is produced under the value element that defines all of the types that may be used in the open type eleemnt This is the resulting XSD definition lt xsd complexType name InitiatingMessage gt lt xsd sequence gt lt xsd element name procedureID type NBAP CommonDataTypes ProcedurelD gt lt xsd element name criticality type NBAP CommonDataTypes Criticality gt lt xsd element name messageDiscriminator type NBAP CommonDataTypes MessageDiscriminator lt xsd element name transactionID type NBAP CommonDataTypes TransactionID gt 19 Elements with Table Constraints lt xsd element name value gt lt xsd complexType gt lt xsd choice gt lt xsd element name radioLinkSetupFDD type NBAP PDU Contents RadioLinkSetupRequestFD lt xsd element name radioLinkSetupTDD type NBAP PDU Contents RadioLinkSetupRequestTDl lt xsd choice gt lt xsd complexType gt lt xsd element gt lt xsd
9. URE radioLinkSetupFDD 18 Elements with Table Constraints radioLinkSetupTDD The NBAP ELEMENTAR Y PROCEDURE class is defined as follows NBAP ELEMENTARY PROCEDURE CLASS amp InitiatingMessage amp SuccessfulOutcome OPTIONAL amp UnsuccessfulOutcome OPTIONAL amp Outcome OPTIONAL amp messageDiscriminator MessageDiscriminator amp procedureID ProcedureID UNIQUE amp criticality Criticality DEFAULT ignore WITH SYNTAX INITIATING MESSAGE amp InitiatingMessage SUCCESSFUL OUTCOME amp SuccessfulOutcome UNSUCCESSFUL OUTCOME amp UnsuccessfulOutcome OUTCOME amp Outcome MESSAGE DISCRIMINATOR amp messageDiscriminator PROCEDURE ID amp procedureID CRITICALITY gcriticality Finally the information objects that are referenced in the information object set are as follows RadioLinkSetup FDD radioLinkSetupFDD NBAP ELEMENTARY PROCEDURE INITIATING MESSAGE RadioLinkSetupRequestFDD SUCCESSFUL OUTCOME RadioLinkSetupResponseFDD UNSUCCESSFUL OUTCOME RadioLinkSetupFailureFDD MESSAGE DISCRIMINATOR common P C ROCEDURE ID procedureCode id radioLinkSetup ddMode fdd RITICALITY reject RadioLinkSetup TDD radioLinkSetupTDD NBAP ELEMENTARY PROCEDURE INITIATING ME
10. acter may be specified for lt typeName gt to indicate that all productions within an ASN 1 module should be treated as PDU types targetns lt URI gt Specify URI for target namespace to be added to the generated XSD code If this option is omitted no target namespace declaration is added None Output information on compiler generated warnings warnings ASN 1 to XML Schema Conversion The ASNIC compiler contains the capability of generating corresponding XML Schema type def initions from ASN 1 types This capability is also present in a free online tool ASN2XSD that may be accessed via the following URL http www obj sys com asn2xsd php http www obj sys com asn2xsd php ASN 1 types are converted to XML Schema and ASN 1 values are converted to XML ASN 1 value sets which are essentially a set of constraints get converted to facets in XML Schema Mapping of Top Level Constructs An ASN 1 module name is mapped to an XML schema namespace ASN 1 IMPORT statements are mapped to XSD import statements The ASN 1 EXPORT statement does not have a corresponding construct in XSD The general form of the XSD namespace and import statements would be as follows lt xml version 1 0 gt lt xsd schema xmlns xsd http www w3 org 2001 XMLSchema targetNamespace URL ModuleName lt following line would be added for each imported module namespace gt xmlns ImportedModuleName importURL ImportedModuleName
11. al ASN 1 specific infor mation This includes information about tags enumerated types or extension types The argument is optional if no argument is given information is gen erated for all of these items It is also possible to specify multiple items by using a comma separated list for example appInfo tags enum tables lt file This option is used to generate additional code for the handling of table con name gt straints as defined in the X 682 standard See the Generated Information Ob ject Table Structures section for additional details on the type of code gener ated to support table constraints I lt directo This option is used to specify a directory that the compiler will search for ry gt ASN 1 source files for IMPORT items Multiple I qualifiers can be used to specify multiple directories to search list None Generate listing This will dump the source code to the standard output device as it is parsed This can be useful for finding parse errors 0 lt directo This option is used to specify the name of a directoryto which all of the gen ry gt erated files will be written pdu lt type Designate given type name to be a Protocol Definition Unit PDU type Name gt This will cause a C control class to be generated for the given type By default PDU types are determined to be types that are not referenced by any other types within a module This option allows that behavior to be overrid den The wildcard char
12. asn NULL and has the following definition lt xsd complexType name NULL final all gt This is a non extendable empty complex type OBJECT IDENTIFIER There is no built in XSD type that corresponds to the ASN 1 OBJECT IDENTIFIER type For this reason a custom type was created in the Objective Systems XSD run time library asn xsd to model this type This type is asn1 ObjectIdentifier and has the following definition lt xsd simpleType name ObjectIdentifier gt lt xsd restriction base xsd token gt lt xsd pattern value 0 2 1 3 0 9 d gt lt xsd restriction gt lt xsd simpleType gt The pattern enforces the rule in the X 680 standard that the first arc value of an OID must be between O and 2 the second arc must be between 0 and 39 and the remaining arcs can be any 10 RELATIVE OID number The ASN 1 OBJECT IDENTIFIER type is converted into a reference to this custom type as follows ASN 1 production TypeName OBJECT IDENTIFIER Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl ObjectIdentifier gt lt xsd simpleType gt RELATIVE OID There is no built in XSD type that corresponds to the ASN 1 RELATIVE OID type For this reason a custom type was created in the Objective Systems XSD run time library asn1 xsd to model this type This type is asn1 RelativeOID and has the following definition lt xsd simpleTy
13. ault directory is assumed If a file extension is not provided the default extension asn is appended to the name Multiple source filenames may be specified on the command line to compile a set of files The wildcard characters and are also allowed in source filenames for example the command asn2xsd asn will compile all ASN 1 files in the current working directory The source file s must contain ASN 1 productions that define ASN 1 types and or value specifi cations This file must strictly adhere to the syntax specified in ASN 1 standard ITU X 680 The deprecated X 208 standard is not supported in ASN2XSD although the ANY type from that stan dard is recognized The following table lists all of the command line options related to ASN 1 to XSD translation Option Argu Description ment appInfo tags This option instructs asn2xsd to generate an lt appinfo gt section within the enum ext generated XSD file that contains additional ASN 1 specific information This includes information about tags enumerated types or extension types The argument is optional if no argument is given information is generated for all of these items It is also possible to specify multiple items by using a comma separated list for example appInfo tags enum attrs tags This option instructs asn2xsd to generate non native attributes for elements enum ext within the generated XSD file that contain addition
14. cial mapping to be done This is only done when the tables option is specified ASN 1 type definitions can be created that reference class fields and that are constrained by objects defined within an Information Object Set The XSD mapping for these types contain normal ele ment declarations for fixed type value fields and special open type elements for type fields The special open type elements will reference an anonymous lt choice gt complexType that will contain an alternative for each of the type fields listed in the referenced information object set that are allowed for the type The basic mapping is as follows ASN 1 Definition TypeName SEQUENCE lementl name FixedTypeFieldRef TableConstraint lement2 name FixedTypeFieldRef TableConstraint key 17 Elements with Table Constraints lement3 name TypeFieldRef TableConstraint key Any combination of fixed type and type fields can be contained within the type definition Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence gt lt xsd element name elemlName type FieldlType gt lt xsd element name elem2Name type Field2Type gt lt xsd element name elem3Name gt lt xsd complexType gt lt xsd choice gt lt xsd element name infoObjectName type InfoObjectType gt lt xsd choice gt lt xsd complexType gt lt xsd element gt lt xsd sequence gt lt xsd complexTy
15. ction base xsd hexBinary gt lt xsd simpleType gt Character String Types All ASN 1 character string useful types 145String VisibleString etc are mapped to the XSD string type ASN 1 production TypeName ASNlCharStringType in this definition ASN CharStringType would be replaced with one of the ASN 1 Character String types such as VisibleString Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd string gt lt xsd simpleType gt ASN 1 character string types may contain a size constraint This is converted into minLength and maxLength facets in the generated XSD definition ASN 1 production TypeName ASN1CharStringType SIZE lower upper Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd string gt lt xsd minLength value lower gt lt xsd maxLength value upper gt lt xsd restriction gt lt xsd simpleType gt ASN 1 character string types may also contain permitted alphabet or pattern constraints These are converted into pattern facets in the generated XSD definition ASN 1 production TypeName ASNlCharStringType FROM charSet or TypeName ASN1CharStringType PATTERN pattern Time String Types Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd string gt lt xsd pattern value pattern gt lt xsd restriction gt lt xsd
16. d IMPLICIT or EXPLICIT The type that specifies this information is the asn1 TagInfo type in the Objective Systems XSD class library For the non native attributes case specified by adding attrs tags or attrs with no qualifiers to the ASNIC command line the mapping of an ASN 1 tagged type to XSD is as follows ASN 1 production TypeName Tagging TagClass TagID ASN1Type Generated XSD code lt xsd complexType name TypeName asnl tag TagClass TagID asnl tagging EXPLICIT gt equivalent XSD type mapping for ASN1Type lt xsd complexType gt For the appInfo case specified by adding appinfo tags or appinfo with no qualifiers to the ASNIC command line the mapping is as follows lt xsd complexType name TypeName gt lt xsd annotation gt lt xsd appinfo gt lt asn1 TagInfo gt lt asnl TagClass gt TagClass lt asn1 TagClass gt lt asn1 TagID gt TagID lt asn1 TagID gt lt asnl Tagging gt Tagging lt asnl Tagging gt lt asn1 TagInfo gt lt xsd appinfo gt lt xsd annotation gt equivalent XSD type mapping for ASN1Type lt xsd complexType gt Tagging in the definition above is optional If present it is equal to either the keyword EXPLICIT or IMPLICIT The default value is EXPLICIT A default value for all types in a module can also be specified in the ASN 1 module header The tag s form constructed or primitive is not specified in the mapping above This is because this can be determined by
17. d below for the ASN2XSD executable but the same options can be used with ASNIC To test if ASN2XSD was successfully installed enter asn2xsd with no parameters as follows note if you have not updated your PATH variable you will need to enter the full pathname asn2xsd You should observe the following display or something similar ASN2XSD Version 6 2 x ASN 1 to XSD translation tool Copyright c 2003 2009 Objective Systems Inc All Rights Reserved Usage asn2xsd lt filename gt options lt filename gt ASN 1 source file name options warnings Output compiler warning messages o lt directory gt Output file directory I lt directory gt Import file directory list Generate listing appinfo lt items gt Generate appInfo for ASN 1 items lt items gt can be tags enum and or ext ex appinfo tags enum ext default all if lt items gt not given attrs lt items gt Generate non native attributes for lt items gt lt items gt is same as for appinfo targetns lt namespace gt Specify target namespace lt namespace gt is namespace URI if not given no target namespace declaration is added tables Generate XSD code for table constraints stdout Output code to stdout To use ASN2XSD at a minimum an ASN 1 source file must be provided The source file specifi cation can be a full pathname or only what is necessary to qualify the file If directory information is not provided the user s current def
18. e gt lt xsd element name element2 name type element2 name gt lt xsd sequence gt lt xsd complexType gt SET An ASN 1 SET is a constructed type consisting of a series of element definitions that must appear in any order This is very similar to the XSD all complex type and is therefore mapped to this type The basic mapping is as follows ASN 1 production TypeName SET lement1 nam lementl type lement2 nam lement2 type Generated XSD code lt xsd complexType name TypeName gt lt xsd all gt lt xsd element name elementl name type elementl type gt lt xsd element name element2 name type element2 name gt lt xsd all gt lt xsd complexType gt The rules for mapping elements with optional and default values to XSD that were described in the SEQUENCE section above are also applicable to the SET type 12 SEQUENCE OF SET OF SEQUENCE OF SET OF The ASN 1 SEQUENCE OF or SET OF type is used to specify a repeating collection of a given element type This is similar to an array type in a high level programming language For all practical purposes SEQUENCE OF and SET OF are identical The remainder of this section will refer to the SEQUENCE OF type only It can be assumed that all of the defined mappings apply to the SET OF type as well The way the SEQUENCE OF type is mapped to XSD depends on the type of the referenced ele ment If the type is one of the followin
19. e default conversion if the INTEGER value contains no constraints is to the XSD integer type ASN 1 production TypeName INTEGER Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd integer gt lt xsd simpleType gt If the integer has a value range constraint that allows a more restrictive XSD type to be used then that type will be used For example if a range of 0 to 255 inclusive is specified an XSD unsignedByte would be used because it maps exactly to this range The following table shows the range values for each of the INTEGER type mappings Lower Bound Upper Bound XSD Type 128 127 byte 0 255 unsignedB yte 32768 32767 short 0 65535 unsignedShort 2147483648 2147483647 integer 0 4294967295 unsignedInt 9223372036854775808 9223372036854775807 long 0 18446744073709551615 unsignedLong BIT STRING Ranges beyond long or unsignedLong will cause the integer value to be treated as a big inte ger This will map to an xsd string type An integer can also be specified to be a big integer using the ASNIC lt isBigInteger gt configuration file setting If constraints are present on the INTEGER type that are not exactly equal to the lower and upper bounds specified above then xsd minInclusive and xsd maxInclusive facets will be added to the XSD type mapping For example the mapping of I INTEGER 0 10 would be do
20. ed the user s current default directory is assumed Multiple source filenames may be specified on the command line to compile a set of files The wildcard characters and are also allowed in source filenames for example the command xsd2asnl xsd will translate all XSD files in the current working directory to ASN 1 The following table lists all of the command line options supported in this version of the tool Option Argument Description all None This option is used to specify that all dependent files should be translated to ASN 1 as well as the main file being compiled This includes all files included using XSD lt include gt and lt im port gt directives config lt filename gt This option is used to spec ify the name of a file con taining configuration informa tion for the source file s being parsed A full discussion of the contents of a configuration file is provided in the XML Schema Binding File section I lt directory gt This option is used to specify a directory that the compiler will search for ASN 1 source files for IMPORT items Multiple I qualifiers can be used to specify multiple directories to search 0 lt directory gt This option is used to specify the name of a directory to which all of the generated files will be written 22 XML Schema Binding File Option Argument Description warnings None Output information on compiler generated
21. elementFormDefault qualified gt lt xsd import namespace importURL ImportedModuleName schemaLocation ImportedModuleName xsd gt In this definition the items in italics would be replaced with text from the ASN 1 specification being converted or a configuration file The ModuleName and ImportedModuleName items would come from the ASN 1 specification The URL and importURL items would be configuration pa rameters Mapping of ASN 1 Types Each ASN 1 type is mapped to a corresponding XSD type Some ASN 1 types have a natural mapping to an XSD type for example an ASN 1 BOOLEAN type maps to an xsd boolean type In other cases custom types were needed because a natural mapping did not exist within XSD for example there was no direct mapping for an ASN 1 BIT STRING type These custom types can be found in the low level ASN 1 XML schema definitions library at the following URL http www obj sys com v1 0 XMLSchema asn1 xsd BOOLEAN The following sections describe the mappings for each of the ASN 1 built in types BOOLEAN The ASN 1 BOOLEAN type is mapped to the XSD boolean built in type ASN 1 production TypeName BOOLEAN Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd boolean gt lt xsd simpleType gt INTEGER The ASN 1 INTEGER type is converted into one of several XSD built in types depending on value range constraints on the integer type definition Th
22. g ASN 1 primitive types or a type reference that references one of these types e BOOLEAN e INTEGER e ENUMERATED e REAL The mapping is to the XSD list type This is a list of space separated identifiers The syntax is as follows ASN 1 production TypeName SEQUENCE OF ElementType Generated XSD code lt xsd simpleType name TypeName gt lt xsd list itemType ElementType gt lt xsd simpleType gt This will be referred to as the simple case from this point forward If the element type is any other type than those listed above the ASN 1 type is mapped to an XSD sequence complex type that contains a single element of the element type The generated XSD type also contains the maxOccurs and possibly the minOccurs facet to specify the array bounds The general mapping of an unbounded SEQUENCE OF type i e one with no size constraint to XSD is as follows ASN 1 production TypeName SEQUENCE OF ElementType Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence maxOccurs unbounded gt 13 CHOICE lt xsd element name element type ElementType gt lt xsd sequence gt lt xsd complexType gt In this definition the element name is the hard coded value element The element type is the equivalent XSD type for the ASN 1 element type As of the 2002 version of the ASN 1 standards it is now possible to include an element identifier
23. n arts 21 Running the XSD to ASN 1 Translation Tool from the Command line 21 AME Schema Bindine ad 23 XSD to ASN 1 Information Item Mappings uccrsssesssseessnsenssnnensnnnnnnnnnnnnnnnenn nenn 24 111 iv Overview of ASN 1 XSD Translation The ASNIC code generation tool translates an Abstract Syntax Notation 1 ASN 1 source file into computer language source files that allow ASN 1 data to be encoded decoded This release of ASNIC contains facilities to translate ASN 1 source specifications to an equivalent representation in World Wide Web Consortium W3C XML Schema Definition language XSD A utility program is also provided to do the reverse translation from XSD to ASN 1 as specified in the ITU T X 694 standard This is the xsd2asn1 executable program located in the installation bin subdirectory This program is described in the XML Schema to ASN 1 Conversion http www obj sys com docs acv62 XSDHTML ch04 html section Using the ASN2XSD command line tool The ASN 1 to XSD translation capability is available in both the ASN1C compiler and in a sepa rate tool named ASN2XSD To generate XSD code using ASNIC add xsd to the ASNIC com mand line or check the box in the ASN1C GUI wizard for generating an equivalent XSD file The same result can be obtained by running ASN2XSD directly In both cases options are available for customizing the generated XSD code These are summarize
24. n Item Map pings All XSD to ASN 1 information item mappings are as specified in the ITU T X 694 standard a free copy of which is available at the following URL http www itu int ITU T study groups com17 languages X694pdf The only non standardized item is the module name used for the generated ASN 1 module XSD2ASN1 assigns module name as follows 1 It will attempt to use the last delimitted item at the far right in the target namespace declaration For example if the target namespace URI is http foo bar Bar will be used as the module name note the first letter was capitialized as per X 694 naming rules 2 If the target namespace is not in a standard URI format or if the last delimitted name contains special chanracters or is very long then the name of the original XSD source file is used 24
25. ne as follows 1 The most restrictive type would first be chosen based on the constraints In this case xsd byte would be used because it appears first on the list above 2 Then the xsd minInclusive and xsd maxInclusive facets would be added to further restrict the type This would result in the following mapping lt xsd simpleType name I gt lt xsd restriction base xsd byte gt lt xsd minInclusive value 0 gt lt xsd maxInclusive value 10 gt lt xsd restriction gt lt xsd simpleType gt BIT STRING There is no built in XSD type that corresponds to the ASN 1 BIT STRING type For this reason a custom type was created in the ASN2XSD run time library asn1 xsd to model this type This type is asn1 BitString and has the following definition lt xsd simpleType name BitString gt lt xsd restriction base xsd token gt lt xsd pattern value 0 1 0 gt lt xsd restriction gt lt xsd simpleType gt The ASN 1 BIT STRING type is converted into a reference to this custom type as follows ASN 1 production TypeName BIT STRING Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl BitString gt lt xsd simpleType gt OCTET STRING The ASN 1 OCTET STRING type is converted into the XSD hexBinary type Character String Types ASN 1 production TypeName OCTET STRING Generated XSD code lt xsd simpleType name TypeName gt lt xsd restri
26. ntains an ellipses marker a special element will be inserted to allow an unknown alternative to be validated This element is as follows lt xsd any namespace other processContents lax gt This element declaration allows any additional elements from other namespaces to exist in a mes sage instance without causing a validation or decoding error Note the restriction that the element must be defined in a different namespace This is necessary because if the element existed in the same namespace as other elements the content model would be non deterministic The reason is because a validation program would not be able to determine if the choice alternative element is a defined element or an extension element Open Type An Open Type as defined in the X 680 standard is specified as a reference to a Type Field in an Information Object Class The most common form of this is when the Type field in the built in TYPE IDENTIFIER class is referenced as follows TYPE IDENTIFIER amp Type A reference to an Open Type within a SEQUENCE or CHOICE construct is converted into an XSD any element type Note that the conversion is only done if the element is in one of these constructs An open type declaration on its own has no equivalent XSD type and is therefore ignore An example showing how an open type might be referenced in a SEQUENCE type and the corre sponding conversion to XSD is as follows SeqwithOpenType SEQUENCE
27. pe gt In this case the fixed type field types are obtained directly from the class definition The type field 1s a reference to the generated open type field The generated lt choice gt container type contains all of the possible elements allowed by the table constraint for the open type field Example This example is from a modified version of the 3GPP NBAP ASN 1 specification Thsi protocol makes heavy use of classes information objects and information object sets One example of this is the NBAP nitiatingMessage type which is defined is as follows InitiatingMessage SEQUENCE procedureID NBAP ELEMENTARY PROCEDURE amp procedureID NBAP ELEMENTARY PROCEDURES criticality NBAP ELEMENTARY PROCEDURE gcriticality NBAP ELEMENTARY PROCEDURES procedurelID messageDiscriminator NBAP ELEMENTARY PROCEDURE amp messageDiscriminator NBAP ELEMENTARY PROCEDURES procedureID transactionID TransactionID value NBAP ELEMENTARY PROCEDURE amp InitiatingMessage NBAP ELEMENTARY PROCEDURES procedurelID A simplified version of the NBAP ELEMENTARY PROCEDURES information object set that defines the contents of some of the element fields is as follows NBAP ELEMENTARY PROCEDURES NBAP ELEMENTARY PROCED
28. pe name RelativeOID gt lt xsd restriction base xsd token gt lt xsd pattern value d d gt lt xsd restriction gt lt xsd simpleType gt This is similar to the OBJECT IDENTIFIER type discussed in the previous section except in this case the pattern is simpler The arc numbers in a RELATIVE OID are not restricted in any way hence the simpler pattern The ASN 1 RELATIVE OID type is converted into a reference to this custom type as follows ASN 1 production TypeName RELATIVE OID Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl Relative0ID gt lt xsd simpleType gt REAL The ASN 1 REAL type is mapped to the XSD double built in type ASN 1 production TypeName REAL Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd double gt lt xsd simpleType gt 11 SEQUENCE SEQUENCE An ASN 1 SEQUENCE is a constructed type consisting of a series of element definitions that must appear in the specified order This is very similar to the XSD sequence complex type and is therefore mapped to this type The basic mapping is as follows ASN 1 production TypeName SEQUENCE lement1 nam lementl type lement2 nam lement2 type Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence gt lt xsd element name elementl name type elementl typ
29. s 1 0 Therefore the outer level of the schema bindings file will always look like this lt bindings version 1 0 gt specific binding elements here lt bindings gt The only element supported below the lt bindings gt level is the lt schemaBindings gt element This allows the association of configuration items with a specific schema The schema is specified using the namespace attribute which identifies the schema using its target namespace The actual location of an include or import file can then be specified using the binding file lt source File gt element The content of this element is the full or relative pathname to the schema file on a local computer access to a web URI is not supported at this time As an example suppose a schema contained the following import directive lt xsd import namespace http example com ImportElement schemaLocation aImportElement xsd gt It is possible to specify a different path for the almportElement xsd file if it did not reside in the cur rent working directory using a schema binding file Assume it was located in the c importSchemas directory The binding file would be as follows 23 XSD to ASN 1 Information Item Mappings lt bindings version 1 0 gt lt schemaBindings namespace http example com ImportElement gt lt sourceFile gt c importSchemas aImportElement xsd lt sourceFile gt lt schemaBindings gt lt bindings gt XSD to ASN 1 Informatio
30. t xsd simpleType gt NULL The asnl value attributes added to the enumeration items above are an example of non native at tributes These are attributes that are not defined within the XML Schema standard but that may be added to provide additional information about an element contained within the schema Con formant XML schema processors should ignore these attributes They are only added to the gen erated code if the attrs enum option is added to the ASNIC command line or attrs option with no qualifiers It is also possible to generate an application information appinfo section within the generated schema containing information on the enumerated values This is done using the appinfo enum option or appinfo with no qualifiers The generated code with lt appinfo gt would be as follows lt xsd simpleType name TypeName gt lt xsd annotation gt lt xsd appinfo gt lt asnl EnumInfo gt lt asnl EnumItem name id1 value vall gt lt asnl EnumItem name id2 value val2 gt lt asnl EnumInfo gt lt xsd appinfo gt lt xsd annotation gt lt xsd restriction base xsd token gt lt xsd enumeration name id1 gt lt xsd enumeration name id2 gt lt xsd restriction gt lt xsd simpleType gt NULL There is no built in XSD type that corresponds to the ASN 1 NULL type For this reason a custom type was created in the Objective Systems XSD run time library asn1 xsd to model this type This type is
31. warnings XML Schema Binding File The schema bindings file is an XML file that allows customizations of certain aspects of the XSD to ASN 1 translation process It is different from command line switches in that it provides a way to associate configuration items with specific XSD information items within a schema or set of schemas For this release of XSD2ASNI the only useful configuration item that can be specified is the location of individual source files for schemas included using the lt xsd include gt and lt xsd import gt declarations These declarations allow a schemaLocation attribute to be specified but this attribute does not necessarily have to contain a full path to the referenced file it is described in the standard as only providing a hint for a schema processor to help in locating the file Since third party schemas cannot always be editied by developers the schema binding file provides a mechanism to bind the file location information to the schema without requiring edits to the original schema At the outer level of the schema binding file is a lt bindings gt element This is a container element that holds all of the binding elements for specific schemas There can be one and only one lt bind ings gt element in a schema bindings file This element contains a mandatory version attribute that specifies the verion of the schema binding language in use For this version of XSD2ASN1 the only supported version i
Download Pdf Manuals
Related Search
Related Contents
Formation par la Recherche n°20, septembre 1987 Laufbänder der Serie 91Ti und 90T Loopband 91Ti Manuel d`utilisation IMPR-110 PowrMover® - CaravanMoverShop.de PhoenIX™ Gigaprep Kit WCAG/ADA Checklist User Manual - Austin Hughes Copyright © All rights reserved.
Failed to retrieve file