[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] [ Search: ]

4.16.3 Binary XML

Crystal Space supports various XML loading plugins. One of those plugins is the binary XML plugin which encodes XML in a binary format that is faster to load (but not necesarily smaller).

Converting to and from Binary Format

Using the ‘docconv’ utility you can convert between various document formats. To convert a document to binary you can use:

docconv -outds=binary filename

‘filename’ is either a VFS path to a single file or else the name of a ZIP archive. In that case the ‘world’ file out of that archive will be converted.

To convert a document from binary to ascii XML you can use:

docconv -outds=tinyxml filename

Making Crystal Space Support Binary

Just add the following lines to your application configuration file:

System.Plugins.iDocumentSystem = crystalspace.documentsystem.multiplexer
System.Plugins.iDocumentSystem.1 = crystalspace.documentsystem.xmlread
System.Plugins.iDocumentSystem.2 = crystalspace.documentsystem.binary

The first line means that the document system multiplexer is used when a document is read. This multiplexer makes sure that the correct reader for a format is used. The second line instructs the multiplexer to try to parse all documents with the XML reader first. (The xmlread plugin parses an XML file faster than the tinyxml plugin, however, only the latter one supports creation and modification of XML files - which usually isn't needed for map files and alike.)

If You Parse Documents Manually

If you read CS documents manually somewhere in your app, you should use the following snippet to obtain a document system object:

csRef<iDocumentSystem> docsys = csQueryRegistry<iDocumentSystem> (object_reg);
if (!docsys.IsValid())
  docsys.AttachNew (new csTinyDocumentSystem ());

This uses the document system specified in you app config, but if none was specified falls back to the TinyXML system.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.