Difference between revisions of "New Freeplane File Format (Proposal)"

From Freeplane - free mind mapping and knowledge management software
(removed relation to category coding)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=[http://egebyromedu.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
+
; Attention<nowiki>:</nowiki> : This effort is on hold until further notice (perhaps after release of version 1.2/1.3).
&amp;rArr; ''This page is work in progress for a proposed new file format and not endorsed in any way (yet) by the Freeplane team as a whole
 
'' Discussion happens on the developers' mailing list &amp;lArr;
 
  
 
----
 
----
Line 14: Line 12:
  
 
# Single XML document:
 
# Single XML document:
## a plain XML format with extension &lt;tt&gt;.freeplane&lt;/tt&gt;.&lt;br /&gt;This format allows further for easy automated generation and XSLT transformation.
+
## a plain XML format with extension <tt>.freeplane</tt>.<br />This format allows further for easy automated generation and XSLT transformation.
## the above format in a standard ZIP or JAR file, i.e. if a file named &lt;tt&gt;myfile.freeplane.zip&lt;/tt&gt; or &lt;tt&gt;myfile.freeplane.jar&lt;/tt&gt; contains a file named &lt;tt&gt;myfile.freeplane&lt;/tt&gt;, it will be opened by Freeplane in the same way as the above plain XML format (other files in the same archive will be ignored).&lt;br /&gt; The file format is still easy to generate but takes less space than plain XML, is cleaner to email (some mailers choke on text formats) and can be used to transport other files (even though they will be ignored by Freeplane).
+
## the above format in a standard ZIP or JAR file, i.e. if a file named <tt>myfile.freeplane.zip</tt> or <tt>myfile.freeplane.jar</tt> contains a file named <tt>myfile.freeplane</tt>, it will be opened by Freeplane in the same way as the above plain XML format (other files in the same archive will be ignored).<br /> The file format is still easy to generate but takes less space than plain XML, is cleaner to email (some mailers choke on text formats) and can be used to transport other files (even though they will be ignored by Freeplane).
 
# Package Document:
 
# Package Document:
## a more complex zipped format with extension &lt;tt&gt;.freeplanez&lt;/tt&gt;.&lt;br /&gt; This format allows for embedded styles, images and other 3rd party objects.
+
## a more complex zipped format with extension <tt>.freeplanez</tt>.<br /> This format allows for embedded styles, images and other 3rd party objects.
## the same structure but in an uncompressed directory with extension &lt;tt&gt;.freeplane.d&lt;/tt&gt;.
+
## the same structure but in an uncompressed directory with extension <tt>.freeplane.d</tt>.
  
 
Overall, the XML format is the same in all flavors, and aligned (as much as possible) with the [http://www.oasis-open.org/committees/office/ Open Document Format] from the [http://www.oasis-open.org/ OASIS organization].
 
Overall, the XML format is the same in all flavors, and aligned (as much as possible) with the [http://www.oasis-open.org/committees/office/ Open Document Format] from the [http://www.oasis-open.org/ OASIS organization].
Line 34: Line 32:
 
= Generic rules =
 
= Generic rules =
  
# Each XML file must start with an XML declaration &lt;tt&gt;&lt;nowiki&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+
# Each XML file must start with an XML declaration <tt><nowiki><?xml version="1.0" encoding="UTF-8" ?>
&lt;/nowiki&gt;&lt;/tt&gt;.
+
</nowiki></tt>.
 
#* this means that the Freeplane format is based on XML 1.0 and has UTF-8 as encoding.
 
#* this means that the Freeplane format is based on XML 1.0 and has UTF-8 as encoding.
 
#* (X)HTML entities are not used anymore for accentuated characters but just plain UTF-8 encoding.
 
#* (X)HTML entities are not used anymore for accentuated characters but just plain UTF-8 encoding.
# A single XML document may continue with an XSLT reference like &lt;tt&gt;&lt;nowiki&gt;&lt;?xml-stylesheet type=&quot;application/xslt+xml&quot; href=&quot;url-to-some-XHTML-transformation-sheet&quot;?&gt;&lt;/nowiki&gt;&lt;/tt&gt; as to allow web browsers to render directly Freeplane files.
+
# A single XML document may continue with an XSLT reference like <tt><nowiki><?xml-stylesheet type="application/xslt+xml" href="url-to-some-XHTML-transformation-sheet"?></nowiki></tt> as to allow web browsers to render directly Freeplane files.
 
#* Freeplane must ignore (but keep) such entries and should add a default one when creating a new map.
 
#* Freeplane must ignore (but keep) such entries and should add a default one when creating a new map.
#* The Freeplane team should offer standard XSLT transformation sheets e.g. under &lt;tt&gt;http://freeplane.org/formats/2010/to-xhtml10.xsl&lt;/tt&gt;.
+
#* The Freeplane team should offer standard XSLT transformation sheets e.g. under <tt>http://freeplane.org/formats/2010/to-xhtml10.xsl</tt>.
 
# All XML markups are in small caps and must have an explicit namespace
 
# All XML markups are in small caps and must have an explicit namespace
 
# The namespace must be declared either as xmlns:attribute of the root element of the XML file, or, if rendered by a plug-in, as xmlns:attribute of the XML element rendered by this plug-in
 
# The namespace must be declared either as xmlns:attribute of the root element of the XML file, or, if rendered by a plug-in, as xmlns:attribute of the XML element rendered by this plug-in
#; Example : if a node has the xmlns attribute &lt;tt&gt;&lt;nowiki&gt;&lt;map:node xmlns:myplug=&quot;myplug-namespace&quot; ...&gt;[...]&lt;/nowiki&gt;&lt;/tt&gt;, Freeplane could find an OSGi service &lt;tt&gt;NodeRenderer&lt;/tt&gt; with a filter based on the given namespace to render this specific node.
+
#; Example : if a node has the xmlns attribute <tt><nowiki><map:node xmlns:myplug="myplug-namespace" ...>[...]</nowiki></tt>, Freeplane could find an OSGi service <tt>NodeRenderer</tt> with a filter based on the given namespace to render this specific node.
# The namespace for Freeplane specific elements is &lt;tt&gt;xmlns:map=&quot;http://freeplane.org/formats/2010/map&quot;&lt;/tt&gt;.
+
# The namespace for Freeplane specific elements is <tt>xmlns:map="http://freeplane.org/formats/2010/map"</tt>.
# Until further notice, all formatting elements are based on XHTML 1.0/1.1 and have the namespace &lt;tt&gt;xmlns:xhtml=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/tt&gt;.
+
# Until further notice, all formatting elements are based on XHTML 1.0/1.1 and have the namespace <tt>xmlns:xhtml="http://www.w3.org/1999/xhtml"</tt>.
 
#* SimplyHTML must be adapted accordingly, and perhaps released as OSGi bundle!?
 
#* SimplyHTML must be adapted accordingly, and perhaps released as OSGi bundle!?
  
Line 62: Line 60:
 
We stick to the same namespaces wherever applicable, and add the following one:
 
We stick to the same namespaces wherever applicable, and add the following one:
  
{| border=&quot;1&quot;
+
{| border="1"
 
|+ Table 6 - Freeplane namespaces
 
|+ Table 6 - Freeplane namespaces
 
|-  
 
|-  
Line 79: Line 77:
 
==== 3.1 Document Representation ====
 
==== 3.1 Document Representation ====
  
===== 3.1.2 &lt;office:document&gt;(Single OpenDocument XML Files) =====
+
===== 3.1.2 <office:document>(Single OpenDocument XML Files) =====
  
 
A typical single opendocument might look as follows:
 
A typical single opendocument might look as follows:
  
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+
  <?xml version="1.0" encoding="UTF-8" ?>
  &lt;?xml-stylesheet type=&quot;application/xslt+xml&quot; href=&quot;http://freeplane.org/formats/2010/to-xhtml10.xsl&quot; ?&gt;
+
  <?xml-stylesheet type="application/xslt+xml" href="http://freeplane.org/formats/2010/to-xhtml10.xsl" ?>
  &lt;office:document office:mimetype=&quot;application/x-freeplane&quot; office:version=&quot;1.2-fp-1.0&quot; xmlns:[...]&gt;
+
  <office:document office:mimetype="application/x-freeplane" office:version="1.2-fp-1.0" xmlns:[...]>
   &lt;office:automatic-styles&gt; [...] &lt;/office:automatic-styles&gt;
+
   <office:automatic-styles> [...] </office:automatic-styles>
   &lt;office:body&gt;             [...] &lt;/office:body&gt;
+
   <office:body>             [...] </office:body>
   &lt;office:font-face-decls&gt; [...] &lt;/office:font-face-decls&gt;
+
   <office:font-face-decls> [...] </office:font-face-decls>
   &lt;office:master-styles&gt;   [...] &lt;/office:master-styles&gt;
+
   <office:master-styles>   [...] </office:master-styles>
   &lt;office:meta&gt;             [...] &lt;/office:meta&gt;
+
   <office:meta>             [...] </office:meta>
   &lt;office:scripts&gt;         [...] &lt;/office:scripts&gt;
+
   <office:scripts>         [...] </office:scripts>
   &lt;office:settings&gt;         [...] &lt;/office:settings&gt;
+
   <office:settings>         [...] </office:settings>
   &lt;office:styles&gt;           [...] &lt;/office:styles&gt;
+
   <office:styles>           [...] </office:styles>
  &lt;/office:document&gt;
+
  </office:document>
  
; Notes : Once Freeplane has a registered mime-type, mimetype could become &lt;tt&gt;application/freeplane&lt;/tt&gt;. The version is made of the ODF version 1.2, 'fp' for Freeplane and an internal version number, 1.0 to start with.
+
; Notes : Once Freeplane has a registered mime-type, mimetype could become <tt>application/freeplane</tt>. The version is made of the ODF version 1.2, 'fp' for Freeplane and an internal version number, 1.0 to start with.
  
 
===== 3.1.3 Package OpenDocument Files =====
 
===== 3.1.3 Package OpenDocument Files =====
  
File &lt;tt&gt;'''content'''.xml&lt;/tt&gt;:
+
File <tt>'''content'''.xml</tt>:
  
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+
  <?xml version="1.0" encoding="UTF-8" ?>
  &lt;office:document-'''content''' office:version=&quot;1.2-fp-1.0&quot; xmlns:[...]&gt;
+
  <office:document-'''content''' office:version="1.2-fp-1.0" xmlns:[...]>
   &lt;office:automatic-styles&gt; [...] &lt;/office:automatic-styles&gt;
+
   <office:automatic-styles> [...] </office:automatic-styles>
   &lt;office:body&gt;             [...] &lt;/office:body&gt;
+
   <office:body>             [...] </office:body>
   &lt;office:font-face-decls&gt; [...] &lt;/office:font-face-decls&gt;
+
   <office:font-face-decls> [...] </office:font-face-decls>
   &lt;office:scripts&gt;         [...] &lt;/office:scripts&gt;
+
   <office:scripts>         [...] </office:scripts>
  &lt;/office:document&gt;
+
  </office:document>
  
File &lt;tt&gt;'''styles'''.xml&lt;/tt&gt;:
+
File <tt>'''styles'''.xml</tt>:
  
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+
  <?xml version="1.0" encoding="UTF-8" ?>
  &lt;office:document-'''styles''' office:version=&quot;1.2-fp-1.0&quot; xmlns:[...]&gt;
+
  <office:document-'''styles''' office:version="1.2-fp-1.0" xmlns:[...]>
   &lt;office:automatic-styles&gt; [...] &lt;/office:automatic-styles&gt;
+
   <office:automatic-styles> [...] </office:automatic-styles>
   &lt;office:font-face-decls&gt; [...] &lt;/office:font-face-decls&gt;
+
   <office:font-face-decls> [...] </office:font-face-decls>
   &lt;office:master-styles&gt;   [...] &lt;/office:master-styles&gt;
+
   <office:master-styles>   [...] </office:master-styles>
   &lt;office:styles&gt;           [...] &lt;/office:styles&gt;
+
   <office:styles>           [...] </office:styles>
  &lt;/office:document&gt;
+
  </office:document>
  
File &lt;tt&gt;'''meta'''.xml&lt;/tt&gt;:
+
File <tt>'''meta'''.xml</tt>:
  
  &lt;?xml version=&quot;1.0&quot; office:version=&quot;1.2-fp-1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+
  <?xml version="1.0" office:version="1.2-fp-1.0" encoding="UTF-8" ?>
  &lt;office:document-'''meta''' xmlns:[...]&gt;
+
  <office:document-'''meta''' xmlns:[...]>
   &lt;office:meta&gt;             [...] &lt;/office:meta&gt;
+
   <office:meta>             [...] </office:meta>
  &lt;/office:document&gt;
+
  </office:document>
  
File &lt;tt&gt;'''settings'''.xml&lt;/tt&gt;:
+
File <tt>'''settings'''.xml</tt>:
  
  &lt;?xml version=&quot;1.0&quot; office:version=&quot;1.2-fp-1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
+
  <?xml version="1.0" office:version="1.2-fp-1.0" encoding="UTF-8" ?>
  &lt;office:document-'''settings''' xmlns:[...]&gt;
+
  <office:document-'''settings''' xmlns:[...]>
   &lt;office:settings&gt;         [...] &lt;/office:settings&gt;
+
   <office:settings>         [...] </office:settings>
  &lt;/office:document&gt;
+
  </office:document>
  
==== 3.2 &lt;office:meta&gt; ====
+
==== 3.2 <office:meta> ====
  
 
Section can and should be used as-is. No changes needed.
 
Section can and should be used as-is. No changes needed.
  
&amp;rArr; Freeplane should offer a dialog to enter document information.
+
&rArr; Freeplane should offer a dialog to enter document information.
  
==== 3.3 &lt;office:body&gt; ====
+
==== 3.3 <office:body> ====
  
Mandatory section, but only child needed is a Freeplane specific &lt;tt&gt;&lt;nowiki&gt;&lt;x-office:map&gt;&lt;/nowiki&gt;&lt;/tt&gt;.
+
Mandatory section, but only child needed is a Freeplane specific <tt><nowiki><x-office:map></nowiki></tt>.
  
 
; Note : x-office is used instead of office to avoid polluting the 'office' namespace. x-office can be used as an alternative prefix for the same Freeplane namespace as 'map'.
 
; Note : x-office is used instead of office to avoid polluting the 'office' namespace. x-office can be used as an alternative prefix for the same Freeplane namespace as 'map'.
  
==== 3.4 to 3.9 not needed, replaced by &lt;x-office:map&gt; ====
+
==== 3.4 to 3.9 not needed, replaced by <x-office:map> ====
  
&lt;tt&gt;&lt;nowiki&gt;&lt;x-office:map&gt;&lt;/nowiki&gt;&lt;/tt&gt; can contain one or more &lt;tt&gt;&lt;nowiki&gt;&lt;map:map&gt;&lt;/nowiki&gt;&lt;/tt&gt; element, each representing what is currently the root element of a .mm map (with of course necessary adaptations, e.g. &lt;tt&gt;&lt;nowiki&gt;&lt;map:node&gt;&lt;/nowiki&gt;&lt;/tt&gt; instead of &lt;node&gt;).
+
<tt><nowiki><x-office:map></nowiki></tt> can contain one or more <tt><nowiki><map:map></nowiki></tt> element, each representing what is currently the root element of a .mm map (with of course necessary adaptations, e.g. <tt><nowiki><map:node></nowiki></tt> instead of <node>).
  
 
; TBD : The exact content of a map will be described in [[Freeplane_File_Format/Maps]]
 
; TBD : The exact content of a map will be described in [[Freeplane_File_Format/Maps]]
  
==== 3.10 &lt;office:settings&gt; ====
+
==== 3.10 <office:settings> ====
  
 
Section can and should be used as-is. No changes needed.
 
Section can and should be used as-is. No changes needed.
  
Possibly Freeplane doesn't need the full scope and could cope only with &lt;tt&gt;config-item-set&lt;/tt&gt; and &lt;tt&gt;config-item&lt;/tt&gt; as in:
+
Possibly Freeplane doesn't need the full scope and could cope only with <tt>config-item-set</tt> and <tt>config-item</tt> as in:
  
  &lt;office:settings&gt;
+
  <office:settings>
   &lt;config:config-item-set config:name=&quot;''somename''&quot;&gt;
+
   <config:config-item-set config:name="''somename''">
     &lt;config:config-item config:name=&quot;''itemname''&quot; config:type=&quot;''itemtype''&quot;&gt;
+
     <config:config-item config:name="''itemname''" config:type="''itemtype''">
 
       ''ConfigValue''
 
       ''ConfigValue''
     &lt;/config:config-item&gt;
+
     </config:config-item>
 
     [...]
 
     [...]
   &lt;/config:config-item-set&gt;
+
   </config:config-item-set>
   &lt;config:config-item-set config:name=&quot;''someothername''&quot;&gt;
+
   <config:config-item-set config:name="''someothername''">
 
     [...]
 
     [...]
  &lt;/office:settings&gt;
+
  </office:settings>
  
 
; Note : as described in chapter 19.32, The values of the config:type attribute are boolean, short, int, long, double, string, datetime or base64Binary.
 
; Note : as described in chapter 19.32, The values of the config:type attribute are boolean, short, int, long, double, string, datetime or base64Binary.
Line 175: Line 173:
 
A bit unclear, but I understand something like the following is possible:
 
A bit unclear, but I understand something like the following is possible:
  
  &lt;?opendocument cursor-position=&quot;''XXX''&quot; ?&gt;
+
  <?opendocument cursor-position="''XXX''" ?>
  
 
where ''XXX'' is a mean to give the cursor position at the time where the document was saved. In Freeplane's case, it could just be a map and/or node ID, but I'm not fully convinced.
 
where ''XXX'' is a mean to give the cursor position at the time where the document was saved. In Freeplane's case, it could just be a map and/or node ID, but I'm not fully convinced.
  
==== 3.12 + 3.13 &lt;office:script[s]&gt; ====
+
==== 3.12 + 3.13 <office:script[s]> ====
  
 
; TBD : The exact handling of scripts will be described in [[Freeplane_File_Format/Scripts]]
 
; TBD : The exact handling of scripts will be described in [[Freeplane_File_Format/Scripts]]
  
  &lt;office:scripts&gt;
+
  <office:scripts>
   &lt;office:event-listeners&gt;
+
   <office:event-listeners>
 
     TBD: do we need event listeners in Freeplane? How to implement them?
 
     TBD: do we need event listeners in Freeplane? How to implement them?
   &lt;/office:event-listeners&gt;
+
   </office:event-listeners>
   &lt;office:script script:language=&quot;groovy&quot;&gt;
+
   <office:script script:language="groovy">
 
     ''Script Specific Text (can also be a link to an external script)''
 
     ''Script Specific Text (can also be a link to an external script)''
   &lt;/office:script&gt;
+
   </office:script>
   &lt;office:script script:language=&quot;lang2&quot;&gt;
+
   <office:script script:language="lang2">
 
     [...]
 
     [...]
  &lt;/office:scripts&gt;
+
  </office:scripts>
  
==== 3.14 &lt;office:font-face-decls&gt; ====
+
==== 3.14 <office:font-face-decls> ====
  
  &lt;office:font-face-decls&gt;
+
  <office:font-face-decls>
   &lt;style:font-face [...]&gt;
+
   <style:font-face [...]>
   &lt;/style:font-face&gt;
+
   </style:font-face>
   &lt;style:font-face&gt;
+
   <style:font-face>
 
     [...]
 
     [...]
  &lt;/office:font-face-decls&gt;
+
  </office:font-face-decls>
  
I would recommend to skip this function for the next release of Freeplane, chapter 16.21 &lt;style:font-face&gt; seems quite complex to implement. '''TBD!'''
+
I would recommend to skip this function for the next release of Freeplane, chapter 16.21 <style:font-face> seems quite complex to implement. '''TBD!'''
  
 
==== 3.15 Styles ====
 
==== 3.15 Styles ====
  
The elements &lt;office:automatic-styles&gt;, &lt;office:master-styles&gt; and &lt;office:styles&gt; could possibly be used but would possibly need to contain map specific styles.
+
The elements <office:automatic-styles>, <office:master-styles> and <office:styles> could possibly be used but would possibly need to contain map specific styles.
  
 
; TBD : The exact handling of styles will be described in Freeplane_File_Format/Styles
 
; TBD : The exact handling of styles will be described in Freeplane_File_Format/Styles
Line 215: Line 213:
 
The section defines 2 (optional) files described in more details in chapter 2.4 of part 3 of the specification:
 
The section defines 2 (optional) files described in more details in chapter 2.4 of part 3 of the specification:
  
* &lt;tt&gt;META-INF/documentsignatures.xml&lt;/tt&gt; for signature of all files
+
* <tt>META-INF/documentsignatures.xml</tt> for signature of all files
* &lt;tt&gt;META-INF/macrosignatures.xml&lt;/tt&gt; only for signatures of macros
+
* <tt>META-INF/macrosignatures.xml</tt> only for signatures of macros
  
 
Does ''not'' need to be part of next Freeplane release.
 
Does ''not'' need to be part of next Freeplane release.
Line 224: Line 222:
 
The specs define 2 types of metadata:
 
The specs define 2 types of metadata:
  
# RDF Metadata, to be defined in the file &lt;tt&gt;manifest.rdf&lt;/tt&gt; (more details in part 3)
+
# RDF Metadata, to be defined in the file <tt>manifest.rdf</tt> (more details in part 3)
# Non-RDF Metadata, found within the element &lt;tt&gt;&lt;office:meta&gt;&lt;/tt&gt;.
+
# Non-RDF Metadata, found within the element <tt><office:meta></tt>.
  
 
Both can be used as defined in the chapter.
 
Both can be used as defined in the chapter.
Line 239: Line 237:
 
=== 22 Conformance ===
 
=== 22 Conformance ===
  
Chapter 22.2.2 &quot;Conforming OpenDocument Extended Documents&quot; is interesting as it defines what the new Freeplane format needs to fulfill.
+
Chapter 22.2.2 "Conforming OpenDocument Extended Documents" is interesting as it defines what the new Freeplane format needs to fulfill.
  
Freeplane itself would need to comply to 22.3.2 &quot;Conforming OpenDocument Extended Producers&quot;
+
Freeplane itself would need to comply to 22.3.2 "Conforming OpenDocument Extended Producers"
and 22.4 &quot;Consumer Conformance&quot;.
+
and 22.4 "Consumer Conformance".
  
 
=== Appendices A to G ===
 
=== Appendices A to G ===
Line 266: Line 264:
 
The following table shows a summary of all files to be found in an OpenDocument conform package file, as described in the specification:
 
The following table shows a summary of all files to be found in an OpenDocument conform package file, as described in the specification:
  
{| border=&quot;1&quot;
+
{| border="1"
 
|+ Files found in a package according to ODF reference
 
|+ Files found in a package according to ODF reference
 
|-
 
|-
 
! File name !! description !! relevant chapter(s)
 
! File name !! description !! relevant chapter(s)
 
|-
 
|-
| &lt;tt&gt;mimetype&lt;/tt&gt;
+
| <tt>mimetype</tt>
 
| first file in ZIP file, uncompressed, contains mime type i.e. application/x-freeplane or application/freeplane
 
| first file in ZIP file, uncompressed, contains mime type i.e. application/x-freeplane or application/freeplane
 
| 2.3 MIME Media Type
 
| 2.3 MIME Media Type
 
|-
 
|-
| &lt;tt&gt;META-INF/manifest.xml&lt;/tt&gt;
+
| <tt>META-INF/manifest.xml</tt>
 
| manifest file in XML format listing all files in the package with their MIME type and, if needed, encryption options
 
| manifest file in XML format listing all files in the package with their MIME type and, if needed, encryption options
 
| 3 Manifest File
 
| 3 Manifest File
 
|-
 
|-
| &lt;tt&gt;manifest.rdf&lt;/tt&gt;
+
| <tt>manifest.rdf</tt>
 
| meta data file (probably optional for Freeplane)
 
| meta data file (probably optional for Freeplane)
 
| 5 Metadata Manifest Files
 
| 5 Metadata Manifest Files
 
|-
 
|-
| &lt;tt&gt;META-INF/documentsignatures.xml&lt;/tt&gt; &lt;br /&gt; &lt;tt&gt;META-INF/macrosignatures.xml&lt;/tt&gt;
+
| <tt>META-INF/documentsignatures.xml</tt> <br /> <tt>META-INF/macrosignatures.xml</tt>
 
| Signature files respectively for all files and for macros (optional)
 
| Signature files respectively for all files and for macros (optional)
 
| 4 Digital Signatures File (and in Part 1 - 3.16 Document and Macro Signatures)
 
| 4 Digital Signatures File (and in Part 1 - 3.16 Document and Macro Signatures)
 
|-
 
|-
| &lt;tt&gt;Thumbnails/thumbnail.png&lt;/tt&gt;
+
| <tt>Thumbnails/thumbnail.png</tt>
 
| Preview image of size 256x256 and 24 bits (optional)
 
| Preview image of size 256x256 and 24 bits (optional)
 
| 2.8 Preview Image
 
| 2.8 Preview Image
 
|-
 
|-
| &lt;tt&gt;content.xml&lt;/tt&gt; &lt;br /&gt; &lt;tt&gt;styles.xml&lt;/tt&gt; &lt;br /&gt; &lt;tt&gt;meta.xml&lt;/tt&gt; &lt;br /&gt; &lt;tt&gt;settings.xml&lt;/tt&gt;
+
| <tt>content.xml</tt> <br /> <tt>styles.xml</tt> <br /> <tt>meta.xml</tt> <br /> <tt>settings.xml</tt>
 
| Core content, styles, metadata and settings files
 
| Core content, styles, metadata and settings files
 
| Part 1
 
| Part 1
 
|}
 
|}
  
The ODF specification states that a package can contain other files, but it doesn't specify any specific structure (it is also not needed because all such files are referenced in &lt;tt&gt;META-INF/manifest.xml&lt;/tt&gt;). Reading between the lines and analyzing OpenOffice files, I come to the conclusion that all additional files should be in sub-directories with names starting with a capital. Here a few examples/suggestions:
+
The ODF specification states that a package can contain other files, but it doesn't specify any specific structure (it is also not needed because all such files are referenced in <tt>META-INF/manifest.xml</tt>). Reading between the lines and analyzing OpenOffice files, I come to the conclusion that all additional files should be in sub-directories with names starting with a capital. Here a few examples/suggestions:
  
{| border=&quot;1&quot;
+
{| border="1"
 
|+ Directories found in a package to contain 3rd party objects
 
|+ Directories found in a package to contain 3rd party objects
 
|-
 
|-
 
! Directory name !! description
 
! Directory name !! description
 
|-
 
|-
| &lt;tt&gt;Pictures/&lt;/tt&gt;
+
| <tt>Pictures/</tt>
 
| for all images. Freeplane accepts JPEG, PNG and GIF formats.
 
| for all images. Freeplane accepts JPEG, PNG and GIF formats.
 
|-
 
|-
| &lt;tt&gt;Icons/&lt;/tt&gt;
+
| <tt>Icons/</tt>
 
| for user specific icons. Freeplane accepts JPEG, PNG and GIF formats.
 
| for user specific icons. Freeplane accepts JPEG, PNG and GIF formats.
 
|-
 
|-
| &lt;tt&gt;Scripts/&lt;/tt&gt;
+
| <tt>Scripts/</tt>
 
| for Groovy scripts.
 
| for Groovy scripts.
 
|-
 
|-
| &lt;tt&gt;Objects/&lt;/tt&gt;
+
| <tt>Objects/</tt>
 
| for any object that Freeplane would embed without actually being able to do anything with it but just try to display externally.
 
| for any object that Freeplane would embed without actually being able to do anything with it but just try to display externally.
 
|}
 
|}
Line 318: Line 316:
 
; Note : further directories can be added as needed.
 
; Note : further directories can be added as needed.
  
; Note : to embed objects, OpenOffice creates a binary (format ?) reference file &lt;tt&gt;ObjectReplacements/Object N&lt;/tt&gt; (N a growing index) and puts the relevant data in a sub-directory &lt;tt&gt;Object N&lt;/tt&gt;, but I don't think we want to do this.
+
; Note : to embed objects, OpenOffice creates a binary (format ?) reference file <tt>ObjectReplacements/Object N</tt> (N a growing index) and puts the relevant data in a sub-directory <tt>Object N</tt>, but I don't think we want to do this.
  
 
==== 2.4 Encryption ====
 
==== 2.4 Encryption ====
Line 326: Line 324:
 
==== 2.7 Usage of IRIs Within Packages ====
 
==== 2.7 Usage of IRIs Within Packages ====
  
the chapter is a bit unclear, but I understand basically that links to files within the package are just normal relative links. As all files present in the package need to be referenced in &lt;tt&gt;META-INF/manifest.xml&lt;/tt&gt;, Freeplane can safely compare any relative link to the content of this file, and, only if not found, try to resolve the link outside of the package.
+
the chapter is a bit unclear, but I understand basically that links to files within the package are just normal relative links. As all files present in the package need to be referenced in <tt>META-INF/manifest.xml</tt>, Freeplane can safely compare any relative link to the content of this file, and, only if not found, try to resolve the link outside of the package.
  
; Note : when using a packaged directory, the relative link ''outside of the package'' means relative to the directory containing the packaged directory. Example: a packaged directory &lt;tt&gt;/home/ewl/Documents/mymap.freeplane.d&lt;/tt&gt; where &lt;tt&gt;content.xml&lt;/tt&gt; refers to &lt;tt&gt;Scripts/myscript.groovy&lt;/tt&gt;; if internal to the package, the absolute path is &lt;tt&gt;/home/ewl/Documents/mymap.freeplane.d/Scripts/myscript.groovy&lt;/tt&gt;, but externally resolved, it means &lt;tt&gt;/home/ewl/Documents/Scripts/myscript.groovy&lt;/tt&gt;.
+
; Note : when using a packaged directory, the relative link ''outside of the package'' means relative to the directory containing the packaged directory. Example: a packaged directory <tt>/home/ewl/Documents/mymap.freeplane.d</tt> where <tt>content.xml</tt> refers to <tt>Scripts/myscript.groovy</tt>; if internal to the package, the absolute path is <tt>/home/ewl/Documents/mymap.freeplane.d/Scripts/myscript.groovy</tt>, but externally resolved, it means <tt>/home/ewl/Documents/Scripts/myscript.groovy</tt>.
  
 
=== 3 to 5 Manifest, Signatures and Metadata ===
 
=== 3 to 5 Manifest, Signatures and Metadata ===
Line 341: Line 339:
  
 
Relevant summary, to be fulfilled by Freeplane and its format.
 
Relevant summary, to be fulfilled by Freeplane and its format.
 
[[Category:Developer_Documentation]]
 

Latest revision as of 09:08, 16 March 2014

Attention: 
This effort is on hold until further notice (perhaps after release of version 1.2/1.3).

Introduction

Freeplane version 1.0.x (and 1.1.x) was developed using FreeMind's format and file extension (.mm) in an effort to allow a smooth transition to users willing to switch to Freeplane. As Freeplane grows mature and wants to make true its Visions, a new file format is required.

File types and extensions.

A Freeplane file can come in 4 flavors, as single XML document file or as package:

  1. Single XML document:
    1. a plain XML format with extension .freeplane.
      This format allows further for easy automated generation and XSLT transformation.
    2. the above format in a standard ZIP or JAR file, i.e. if a file named myfile.freeplane.zip or myfile.freeplane.jar contains a file named myfile.freeplane, it will be opened by Freeplane in the same way as the above plain XML format (other files in the same archive will be ignored).
      The file format is still easy to generate but takes less space than plain XML, is cleaner to email (some mailers choke on text formats) and can be used to transport other files (even though they will be ignored by Freeplane).
  2. Package Document:
    1. a more complex zipped format with extension .freeplanez.
      This format allows for embedded styles, images and other 3rd party objects.
    2. the same structure but in an uncompressed directory with extension .freeplane.d.

Overall, the XML format is the same in all flavors, and aligned (as much as possible) with the Open Document Format from the OASIS organization.

File format requirements

  1. clean XML
  2. multiple maps per file possible
  3. easy generation
  4. embedding of 3rd party objects
  5. support real styles
  6. allow for comparison between different files
  7. allow for tracked changes

Generic rules

  1. Each XML file must start with an XML declaration <?xml version="1.0" encoding="UTF-8" ?> .
    • this means that the Freeplane format is based on XML 1.0 and has UTF-8 as encoding.
    • (X)HTML entities are not used anymore for accentuated characters but just plain UTF-8 encoding.
  2. A single XML document may continue with an XSLT reference like <?xml-stylesheet type="application/xslt+xml" href="url-to-some-XHTML-transformation-sheet"?> as to allow web browsers to render directly Freeplane files.
  3. All XML markups are in small caps and must have an explicit namespace
  4. The namespace must be declared either as xmlns:attribute of the root element of the XML file, or, if rendered by a plug-in, as xmlns:attribute of the XML element rendered by this plug-in
    Example 
    if a node has the xmlns attribute <map:node xmlns:myplug="myplug-namespace" ...>[...], Freeplane could find an OSGi service NodeRenderer with a filter based on the given namespace to render this specific node.
  5. The namespace for Freeplane specific elements is xmlns:map="http://freeplane.org/formats/2010/map".
  6. Until further notice, all formatting elements are based on XHTML 1.0/1.1 and have the namespace xmlns:xhtml="http://www.w3.org/1999/xhtml".
    • SimplyHTML must be adapted accordingly, and perhaps released as OSGi bundle!?

Format Specifics

(structure aligned with version 1.2 of the Open Document Format)

Part 1 - XML File Format

1 - Introduction

1.1 to 1.4 - no changes

1.5 - Namespaces

We stick to the same namespaces wherever applicable, and add the following one:

Table 6 - Freeplane namespaces
Prefix Description Namespace
map For all Freeplane specific elements http://freeplane.org/formats/2010/map
x-office For Freeplane elements that would belong in the 'office' namespace http://freeplane.org/formats/2010/office

2 - Scope (not relevant)

3 - Document Structure

3.1 Document Representation

3.1.2 <office:document>(Single OpenDocument XML Files)

A typical single opendocument might look as follows:

<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="application/xslt+xml" href="http://freeplane.org/formats/2010/to-xhtml10.xsl" ?>
<office:document office:mimetype="application/x-freeplane" office:version="1.2-fp-1.0" xmlns:[...]>
  <office:automatic-styles> [...] </office:automatic-styles>
  <office:body>             [...] </office:body>
  <office:font-face-decls>  [...] </office:font-face-decls>
  <office:master-styles>    [...] </office:master-styles>
  <office:meta>             [...] </office:meta>
  <office:scripts>          [...] </office:scripts>
  <office:settings>         [...] </office:settings>
  <office:styles>           [...] </office:styles>
</office:document>
Notes 
Once Freeplane has a registered mime-type, mimetype could become application/freeplane. The version is made of the ODF version 1.2, 'fp' for Freeplane and an internal version number, 1.0 to start with.
3.1.3 Package OpenDocument Files

File content.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<office:document-content office:version="1.2-fp-1.0" xmlns:[...]>
  <office:automatic-styles> [...] </office:automatic-styles>
  <office:body>             [...] </office:body>
  <office:font-face-decls>  [...] </office:font-face-decls>
  <office:scripts>          [...] </office:scripts>
</office:document>

File styles.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<office:document-styles office:version="1.2-fp-1.0" xmlns:[...]>
  <office:automatic-styles> [...] </office:automatic-styles>
  <office:font-face-decls>  [...] </office:font-face-decls>
  <office:master-styles>    [...] </office:master-styles>
  <office:styles>           [...] </office:styles>
</office:document>

File meta.xml:

<?xml version="1.0" office:version="1.2-fp-1.0" encoding="UTF-8" ?>
<office:document-meta xmlns:[...]>
  <office:meta>             [...] </office:meta>
</office:document>

File settings.xml:

<?xml version="1.0" office:version="1.2-fp-1.0" encoding="UTF-8" ?>
<office:document-settings xmlns:[...]>
  <office:settings>         [...] </office:settings>
</office:document>

3.2 <office:meta>

Section can and should be used as-is. No changes needed.

⇒ Freeplane should offer a dialog to enter document information.

3.3 <office:body>

Mandatory section, but only child needed is a Freeplane specific <x-office:map>.

Note 
x-office is used instead of office to avoid polluting the 'office' namespace. x-office can be used as an alternative prefix for the same Freeplane namespace as 'map'.

3.4 to 3.9 not needed, replaced by <x-office:map>

<x-office:map> can contain one or more <map:map> element, each representing what is currently the root element of a .mm map (with of course necessary adaptations, e.g. <map:node> instead of <node>).

TBD 
The exact content of a map will be described in Freeplane_File_Format/Maps

3.10 <office:settings>

Section can and should be used as-is. No changes needed.

Possibly Freeplane doesn't need the full scope and could cope only with config-item-set and config-item as in:

<office:settings>
  <config:config-item-set config:name="somename">
    <config:config-item config:name="itemname" config:type="itemtype">
      ConfigValue
    </config:config-item>
    [...]
  </config:config-item-set>
  <config:config-item-set config:name="someothername">
    [...]
</office:settings>
Note 
as described in chapter 19.32, The values of the config:type attribute are boolean, short, int, long, double, string, datetime or base64Binary.

3.11 Cursor Position Setting

A bit unclear, but I understand something like the following is possible:

<?opendocument cursor-position="XXX" ?>

where XXX is a mean to give the cursor position at the time where the document was saved. In Freeplane's case, it could just be a map and/or node ID, but I'm not fully convinced.

3.12 + 3.13 <office:script[s]>

TBD 
The exact handling of scripts will be described in Freeplane_File_Format/Scripts
<office:scripts>
  <office:event-listeners>
    TBD: do we need event listeners in Freeplane? How to implement them?
  </office:event-listeners>
  <office:script script:language="groovy">
    Script Specific Text (can also be a link to an external script)
  </office:script>
  <office:script script:language="lang2">
    [...]
</office:scripts>

3.14 <office:font-face-decls>

<office:font-face-decls>
  <style:font-face [...]>
  </style:font-face>
  <style:font-face>
    [...]
</office:font-face-decls>

I would recommend to skip this function for the next release of Freeplane, chapter 16.21 <style:font-face> seems quite complex to implement. TBD!

3.15 Styles

The elements <office:automatic-styles>, <office:master-styles> and <office:styles> could possibly be used but would possibly need to contain map specific styles.

TBD 
The exact handling of styles will be described in Freeplane_File_Format/Styles

3.16 Document and Macro Signatures

The section defines 2 (optional) files described in more details in chapter 2.4 of part 3 of the specification:

  • META-INF/documentsignatures.xml for signature of all files
  • META-INF/macrosignatures.xml only for signatures of macros

Does not need to be part of next Freeplane release.

4 Metadata

The specs define 2 types of metadata:

  1. RDF Metadata, to be defined in the file manifest.rdf (more details in part 3)
  2. Non-RDF Metadata, found within the element <office:meta>.

Both can be used as defined in the chapter.

5 to 20 (Content, Formatting, attributes, etc...)

TBD 
To Be Used as needed, document here what you use as you implement it!!!

21 Document Processing

Nothing really special...

22 Conformance

Chapter 22.2.2 "Conforming OpenDocument Extended Documents" is interesting as it defines what the new Freeplane format needs to fulfill.

Freeplane itself would need to comply to 22.3.2 "Conforming OpenDocument Extended Producers" and 22.4 "Consumer Conformance".

Appendices A to G

Nothing really relevant in there.

Part 2 - OpenFormula

not applicable (yet?)

Part 3 - Packages

1 Introduction

Nothing really relevant

2 Packages

2.0 list of files

The specification doesn't explicitly contain a list of possible files, so here it is, with a reference to the relevant chapters.

The following table shows a summary of all files to be found in an OpenDocument conform package file, as described in the specification:

Files found in a package according to ODF reference
File name description relevant chapter(s)
mimetype first file in ZIP file, uncompressed, contains mime type i.e. application/x-freeplane or application/freeplane 2.3 MIME Media Type
META-INF/manifest.xml manifest file in XML format listing all files in the package with their MIME type and, if needed, encryption options 3 Manifest File
manifest.rdf meta data file (probably optional for Freeplane) 5 Metadata Manifest Files
META-INF/documentsignatures.xml
META-INF/macrosignatures.xml
Signature files respectively for all files and for macros (optional) 4 Digital Signatures File (and in Part 1 - 3.16 Document and Macro Signatures)
Thumbnails/thumbnail.png Preview image of size 256x256 and 24 bits (optional) 2.8 Preview Image
content.xml
styles.xml
meta.xml
settings.xml
Core content, styles, metadata and settings files Part 1

The ODF specification states that a package can contain other files, but it doesn't specify any specific structure (it is also not needed because all such files are referenced in META-INF/manifest.xml). Reading between the lines and analyzing OpenOffice files, I come to the conclusion that all additional files should be in sub-directories with names starting with a capital. Here a few examples/suggestions:

Directories found in a package to contain 3rd party objects
Directory name description
Pictures/ for all images. Freeplane accepts JPEG, PNG and GIF formats.
Icons/ for user specific icons. Freeplane accepts JPEG, PNG and GIF formats.
Scripts/ for Groovy scripts.
Objects/ for any object that Freeplane would embed without actually being able to do anything with it but just try to display externally.
Note 
further directories can be added as needed.
Note 
to embed objects, OpenOffice creates a binary (format ?) reference file ObjectReplacements/Object N (N a growing index) and puts the relevant data in a sub-directory Object N, but I don't think we want to do this.

2.4 Encryption

probably not in this version of Freeplane

2.7 Usage of IRIs Within Packages

the chapter is a bit unclear, but I understand basically that links to files within the package are just normal relative links. As all files present in the package need to be referenced in META-INF/manifest.xml, Freeplane can safely compare any relative link to the content of this file, and, only if not found, try to resolve the link outside of the package.

Note 
when using a packaged directory, the relative link outside of the package means relative to the directory containing the packaged directory. Example: a packaged directory /home/ewl/Documents/mymap.freeplane.d where content.xml refers to Scripts/myscript.groovy; if internal to the package, the absolute path is /home/ewl/Documents/mymap.freeplane.d/Scripts/myscript.groovy, but externally resolved, it means /home/ewl/Documents/Scripts/myscript.groovy.

3 to 5 Manifest, Signatures and Metadata

Relevant without changes, chapters referenced in files table from chapter 2.

6 Datatypes

Not really of interest.

7 Conformance

Relevant summary, to be fulfilled by Freeplane and its format.