Problem
You may need to accept or distribute XML documents encoded as Fast Infoset.
Resolution
Liquid XML support the Fast Infoset binary standard for C++, C# and VB .Net. Not only can FI documents can be read in and written out, but you can also read in an FI document and write out an XML document and visa-versa. This makes Liquid XML an excellent data conversion tool.
Serialization
FI documents can be read in the same manner as xml documents using the FromXml methods. Liquid XML identifies FI documents and parses them accordingly. Writing FI documents requires the use of the ToFastInfoset methods.
Example
![]() ![]() |
---|
// read in Fast Infoset document... |
![]() ![]() |
---|
// read in Fast Infoset document... |
Generate Fast Infoset Tables in C++
Note: this is an optional feature provided in the Output options screen in the Wizard.
The FI standard specifies that an FI document to use external vocabulary tables. This has the advantage of producing smaller FI documents that do not contain the vocabulary. Liquid XML takes this one step further by allowing the external vocabulary tables to be generated directly into your binding library code. Essentially this means your external vocabulary is contained as internal tables within your code. These tables are built as static data that is only created once at application start up time, and has the dual advantage of reducing parsing time as well as reducing document size.
Important Note: the generated FI documents will now only be interpretid by the exact version of the library that created them. This option should not be used if interoperable with other vendors' FI implementations.
In order to use the generated tables, and hence omit vocabulary content from FI documents, you must set a flag within the FIContext.
Example
![]() ![]() ![]() |
---|
// set the UseGeneratedVocabulary flag within the default serialization context |
As the generated tables are derived from the schema, they only contain element and attribute tag values and do not contain data values. You may also want to extend the default tables with additional data such as known recurring data. E.g. if you have a personal data, you may wish to add common surnames.
You can do this using the AddElementValue and AddAttributeValue CFIVocabulary methods within the PopulateFITables method of the generated class CAppLifetime in the Enumerations.cpp file of your generated library.
The following Example shows common surname values added within the HAND CODED BLOCK after the generated values:
![]() ![]() ![]() |
---|
// Populate internal Fast Infoset tables |
Notes
Description | Value |
---|---|
Article Created | 20/4/2007 |
Version | Liquid XML 2006 and greater |