<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> <html> <!-- Created by texi2html 1.76 --> <!-- Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) Karl Berry <karl@freefriends.org> Olaf Bachmann <obachman@mathematik.uni-kl.de> and many others. Maintained by: Many creative people <dev@texi2html.cvshome.org> Send bugs and suggestions to <users@texi2html.cvshome.org> --> <head> <title>Crystal Space 1.2.1: 4.16.5 Binary XML</title> <meta name="description" content="Crystal Space 1.2.1: 4.16.5 Binary XML"> <meta name="keywords" content="Crystal Space 1.2.1: 4.16.5 Binary XML"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="texi2html 1.76"> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} pre.display {font-family: serif} pre.format {font-family: serif} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: serif; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: serif; font-size: smaller} pre.smalllisp {font-size: smaller} span.sansserif {font-family:sans-serif; font-weight:normal;} ul.toc {list-style: none} --> </style> </head> <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> <a name="Binary-XML"></a> <a name="0"></a> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="Map-File-Hints.html#0" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="Model-Loading.html#0" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="Using-Crystal-Space.html#0" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="Map-Loader.html#0" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="Working-with-Engine-Content.html#0" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <hr size="1"> <h3 class="subsection"> 4.16.5 Binary <small>XML</small> </h3> <p>Crystal Space supports various <small>XML</small> loading plugins. One of those plugins is the binary <small>XML</small> plugin which encodes <small>XML</small> in a binary format that is faster to load (but not necesarily smaller). </p> <a name="1"></a> <h4 class="subsubheading"> Converting to and from Binary Format </h4> <p>Using the <samp>‘docconv’</samp> utility you can convert between various document formats. To convert a document to binary you can use: </p> <table><tr><td> </td><td><pre class="example">docconv -outds=binary filename </pre></td></tr></table> <p><samp>‘filename’</samp> is either a <small>VFS</small> path to a single file or else the name of a <small>ZIP</small> archive. In that case the <tt>‘world’</tt> file out of that archive will be converted. </p> <p>To convert a document from binary to ascii <small>XML</small> you can use: </p> <table><tr><td> </td><td><pre class="example">docconv -outds=tinyxml filename </pre></td></tr></table> <a name="2"></a> <h4 class="subsubheading"> Making Crystal Space Support Binary </h4> <p>Just add the following lines to your application configuration file: </p> <table><tr><td> </td><td><pre class="example">System.Plugins.iDocumentSystem = crystalspace.documentsystem.multiplexer System.Plugins.iDocumentSystem.1 = crystalspace.documentsystem.xmlread System.Plugins.iDocumentSystem.2 = crystalspace.documentsystem.binary </pre></td></tr></table> <p>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.) </p> <a name="3"></a> <h4 class="subsubheading"> If You Parse Documents Manually </h4> <p>If you read CS documents <em>manually</em> somewhere in your app, you should use the following snippet to obtain a document system object: </p> <table><tr><td> </td><td><pre class="example">csRef<iDocumentSystem> docsys = csQueryRegistry<iDocumentSystem> (object_reg); if (!docsys.IsValid()) docsys.AttachNew (new csTinyDocumentSystem ()); </pre></td></tr></table> <p>This uses the document system specified in you app config, but if none was specified falls back to the TinyXML system. </p> <hr size="1"> <table cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="Map-File-Hints.html#0" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="Model-Loading.html#0" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="Using-Crystal-Space.html#0" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="Map-Loader.html#0" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="Working-with-Engine-Content.html#0" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left">[<a href="index.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> <td valign="middle" align="left">[<a href="cs_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> <td valign="middle" align="left">[<a href="cs_Index.html#0" title="Index">Index</a>]</td> <td valign="middle" align="left">[<a href="cs_abt.html#SEC_About" title="About (help)"> ? </a>]</td> </tr></table> <p> <font size="-1"> This document was generated using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>. </font> <br> </p> </body> </html>