https://bugs.freedesktop.org/show_bug.cgi?id=53878

             Bug #: 53878
           Summary: FILESAVE, EasyHack: Size of XML files can been reduced
                    by using default namespaces on certain elements
    Classification: Unclassified
           Product: LibreOffice
           Version: 3.6.0.4 release
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: medium
         Component: Libreoffice
        AssignedTo: [email protected]
        ReportedBy: [email protected]


While creating my own flat spreadsheet file, based on LibreOffice and Google
Spreadsheet saved files, I realised it would save a lot of bytes to add a
default namespace to the <table:table> element, and remove all the table:
prefixes from this element and it's children.

i.e. go from this:

<table:table table:name="" table:style-name="">
 <table:table-column table:style-name="" table:default-cell-style-name=""
table:number-rows-repeated="" table:number-columns-repeated="">
 <table:table-row table:style-name="">
  <table:table-cell table:style-name=""/>
 </table:table-row>
</table:table>

to this:

<table name="" style-name=""
xmlns="urn:oasis:names:tc:opendocument:xmlns:table:1.0">
 <table-column style-name="" default-cell-style-name="" number-rows-repeated=""
number-columns-repeated="">
 <table-row style-name="">
  <table-cell style-name=""/>
 </table-row>
</table>

Such optimisations are surely also available to other document types, not just
spreadsheets.
I also set the style namespace as the default namespace on the office:styles,
office:automatic-styles and office-master-styles elements, followed by removing
style: prefixes from element names and attributes. I brought down a simple (14
cols, 15 rows) 29KB file to 24KB. Since I will be generating and serving these
over the internet for our business application, this 17% reduction (before
compression) is fairly significant.


For bonus credit, since the office: and text: namespaces are necessary on all
and most table cells respectively, reducing the namespace identifiers to "o"
and "t" would further bring down the file size.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to