The latest release of ASN2XML features a DLL component that users can embed in their application programs. This makes it possible to output translated XML to different output mediums such as a GUI window.
Using the DLL is easy. The Asn2Xml.h header file that is included in the download package contains the Asn2Xml class that defines the program interface. The typical steps are to:
- Set the ASN.1 schema(s) using the addAsn1Schema method.
- Create a file input source using the setFileDataSource method (note: alternate data sources such as memory or socket can be created by creating an input stream object).
- Invoke the toXMLFile method to do the translation to a file. It is possible to create alternate output streams for output to different output mediums.
By default, the encoding rules are set to Basic Encoding Rules (BER) and its derivatives (DER or CER). It is also possible to translate PER-encoded data by using the setEncodingRules method.
That is basically it. A key performance advantage that can be gained is that if a lot of files that adhere to the same schema need to be processed (common in CDR applications), the schema file(s) would only need to be loaded and compiled once and a loop could then be set up to process the data files. If the command-line version of the tool were used, the schema files would need to be compiled for each data file processed.
Sample programs showing how to use the DLL are available in the sample_dll directory in the download package.