Version 1 (modified by mira, 15 years ago) (diff) |
---|
The R3 format is not just a Book format but a Resource format. It represents a given Resource with its sub-resources, binary data, cached data, external Resource references, etc.
Since Resources form a hierarchy (for instance Book -> Page -> Frame), the R3 format structure follows the same hierarchy.
The R3 format is a zipped file incorporating some directories and some files:
- each Resource described inside (either the root -resource or any of its sub-resources) has a corresponding directory with some helper directories and files.
The exact structure description of the format is described via an example. Here is a description of the file format for a Book, though any kind of Resource can be saved in similar structure:
- The name of the zip file is something like "ExampleBook.s2b". This name without the file extension (namely "ExampleBook") is the name of the Book Resource. The extension depends on the kind of the resource that is persisted.
- The root directory of the file contains:
- _cache - a directory for caching remote Resources. It is used to load a resource even if you can’t connect to the server.
- _data - a directory for storing binary and text data. Instead of embedding unreadable binary data in the -resource.xml file, it is stored here and just referred from other places (like the .xml files)
- _resource.xml - an .xml file describing the structure and properties of the root-resource.
- Sub-elements directories – All child resources of the current resource are persisted in similar manner in inner directories named with their names in the resource tree. Those resources are kept in the described above manner.
Resource names cannot start with an underscore so they won't conflict with _cache, _data and _resource.xml. Here is a sample _resource.xml for a book:
_resource.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <resource format-version="r3" kind="book"> <title>New Book</title> <pages size="4"> <page index="0"><ref location="./Page Qs5k1U"/></page> <page index="1"><ref location="./PageCs37p5"/></page> <page index="2"><ref location="./PageYIgmpZ"/></page> <page index="3"><ref location="./Pageh3QLuC"/></page> </pages> <page-templates size="1"> <template index="0"><ref location="./PageJd88Us"/></template> </page-templates> <page-size> <height>480.0</height> <width>640.0</width> </page-size> </resource>
- It begins with a standard <xml> tag.
- All other content is wrapped in a <resource> tag which contains the kind of the resource, the file format id (for now it is always "r3") and other attributes that are not threated as regular properties.
- All properties of the resource are saved in appropriate format depending on the type of the value.
- ListProperties are saved in a similar way. There is a xml child for each element of the list and the series of these tags are wrapped in a one bigger tag for the whole ListProperty. All list element tags have an attribute 'index'. This attribute is added because in the xml representation order of the children with the same name on the same level of the xml is not regarded. That means that in the list of pages for example the page elements could change their place in the xml representation but we won`t lose the information for the order in which they were persisted.
Attachments
- GUTSen.book.s2 (148.5 KB) - added by mira 15 years ago.