XML/OpenOffice.org e l'OpenDocument Format

Wikibooks, manuali e libri di testo liberi.
< XML
Jump to navigation Jump to search
Indice del libro

Archives (2).png Obiettivi di apprendimento

  • Scoprire come OpenOffice.org utilizza il formato OpenDocument
  • Scoprire le funzionalità di OpenOffice

OpenOffice.org, come suggerisce il nome, è una suite di applicazioni per ufficio open source. Si basa sul sorgente di StarOffice della Sun Microsystems, donata alla comunità open source nel 2000. OpenOffice.org è in grado di leggere e salvare i file in diversi formati utilizzati da altre applicazioni per ufficio; il suo formato predefinito è però OpenDocument, che è un formato XML standardizzato da OASIS (Organization for the Advancement of Structured Information Standards). OpenOffice.org è destinato ad essere di grande importanza nel futuro prossimo a causa della tendenza, da parte dei governi nazionali, e in particolare nell'Unione Europea, a richiedere che tutti i documenti ufficiali siano salvati in un formato open source.

OpenDocument Format[modifica]

Come indicato nell'introduzione, OpenDocument è un formato XML standardizzato da OASIS. Un file OpenDocument assume la forma di un archivio zip compresso con una delle seguenti estensioni:[1]

  • .odt (testo)
  • .ott (modello di testo)
  • .odm (documento principale)
  • .oth (modello HTML)
  • .ods (foglio di calcolo)
  • .ots (modello di foglio di calcolo)
  • .odg (disegno)
  • .otg (modello di disegno)
  • .odp (presentazione)
  • .otp (modello di presentazione)
  • .odf (formula)
  • .odb (database)

L'archivio zip contiene i file e directory descritti di seguito (dalla documentazione di OpenOffice.org).

Il testo del documento è archiviato in content.xml. Per impostazione predefinita, questa è una versione ridotta del documento che tralascia elementi di formattazione come rientri o interruzioni di riga al fine di semplificare il salvataggio e l'apertura del documento stesso.

<office:document-content namespace declarations
  office:version="1.0"
  office:class="document type">
    
    <office:scripts/>
    
    <office:font-face-decls>
        <!-- font specifications -->
    </office:font-decls>
    
    <office:styles>
        <office:automatic-styles>
            <!-- style information -->
        </office:automatic-styles>
    </office:styles>
    
    <office:body>
        <office:documentType>
            <!-- actual content here -->
        </office:documentType>
    </office:body>
</office:document-content>

meta.xml contiene le meta-informazioni del documento, che possono essere modificate in File - Proprietà. Se un documento viene salvato con una password, meta.xml non verrà crittografato.

 <?xml version="1.0" encoding="UTF-8" ?> 
<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
<office:meta>
  <meta:generator>OpenOffice.org/2.0$Win32 OpenOffice.org_project/680m1$Build-8990</meta:generator> 
  <meta:initial-creator>Creator Name</meta:initial-creator> 
  <meta:creation-date>2006-03-27T19:17:57</meta:creation-date> 
  <dc:creator>Creator Name</dc:creator> 
  <dc:date>2006-03-27T20:58:06</dc:date> 
  <dc:language>en-US</dc:language> 
  <meta:editing-cycles>2</meta:editing-cycles> 
  <meta:editing-duration>PT1H40M37S</meta:editing-duration> 
  <meta:user-defined meta:name="Info 1" /> 
  <meta:user-defined meta:name="Info 2" /> 
  <meta:user-defined meta:name="Info 3" /> 
  <meta:user-defined meta:name="Info 4" /> 
  <meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="2" meta:paragraph-count="6" meta:word-count="567" meta:character-count="3550" /> 
  </office:meta>
  </office:document-meta>

settings.xml contiene ulteriori informazioni sulle impostazioni per questo documento.

  <?xml version="1.0" encoding="UTF-8" ?> 
- <office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.0">
- <office:settings>
- <config:config-item-set config:name="ooo:view-settings">
  <config:config-item config:name="ViewAreaTop" config:type="int">635</config:config-item> 
  <config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item> 
  <config:config-item config:name="ViewAreaWidth" config:type="int">25852</config:config-item> 
  <config:config-item config:name="ViewAreaHeight" config:type="int">14818</config:config-item> 
  <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item> 
- <config:config-item-map-indexed config:name="Views">
- <config:config-item-map-entry>
  <config:config-item config:name="ViewId" config:type="string">view2</config:config-item> 
  <config:config-item config:name="ViewLeft" config:type="int">17549</config:config-item> 
  <config:config-item config:name="ViewTop" config:type="int">4949</config:config-item> 
  <config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item> 
  <config:config-item config:name="VisibleTop" config:type="int">635</config:config-item> 
  <config:config-item config:name="VisibleRight" config:type="int">25850</config:config-item> 
  <config:config-item config:name="VisibleBottom" config:type="int">15452</config:config-item> 
  <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> 
  <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item> 
  <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item> 
  </config:config-item-map-entry>
  </config:config-item-map-indexed>
  </config:config-item-set>
- <config:config-item-set config:name="ooo:configuration-settings">
  <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item> 
  <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> 
  <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="UpdateFromTemplate" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary" /> 
  <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="PrinterSetup" config:type="base64Binary" /> 
  <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item> 
  <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="CurrentDatabaseDataSource" config:type="string" /> 
  <config:config-item config:name="PrinterName" config:type="string" /> 
  <config:config-item config:name="PrintFaxName" config:type="string" /> 
  <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item> 
  <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item> 
  <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item> 
  <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="CurrentDatabaseCommand" config:type="string" /> 
  <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item> 
  <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item> 
  </config:config-item-set>
  </office:settings>
  </office:document-settings>

styles.xml contiene gli stili applicati al documento, che possono essere visualizzati nella finestra Stili e formattazione.

<?xml version="1.0" encoding="UTF-8" ?>  
 <office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" office:version="1.0">
- <office:font-face-decls>
  <style:font-face style:name="Tahoma1" svg:font-family="Tahoma" /> 
  <style:font-face style:name="Arial Unicode MS" svg:font-family="'Arial Unicode MS'" style:font-pitch="variable" /> 
  <style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-pitch="variable" /> 
  <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable" /> 
  <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable" /> 
  </office:font-face-decls>
- <office:styles>
- <style:default-style style:family="graphic">
  <style:graphic-properties draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false" /> 
- <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
  <style:tab-stops /> 
  </style:paragraph-properties>
  <style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" /> 
  </style:default-style>
- <style:default-style style:family="paragraph">
  <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page" /> 
  <style:text-properties style:use-window-font-color="true" style:font-name="Times New Roman" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="Arial Unicode MS" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-name-complex="Tahoma" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" /> 
  </style:default-style>
- <style:default-style style:family="table">
  <style:table-properties table:border-model="collapsing" /> 
  </style:default-style>
- <style:default-style style:family="table-row">
  <style:table-row-properties fo:keep-together="auto" /> 
  </style:default-style>
  <style:style style:name="Standard" style:family="paragraph" style:class="text" /> 
- <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
  <style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in" /> 
  </style:style>
- <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
  <style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always" /> 
  <style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="Arial Unicode MS" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt" /> 
  </style:style>
- <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
  <style:text-properties style:font-name-complex="Tahoma1" /> 
  </style:style>
- <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
  <style:paragraph-properties fo:margin-top="0.0835in" fo:margin-bottom="0.0835in" text:number-lines="false" text:line-number="0" /> 
  <style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Tahoma1" style:font-size-complex="12pt" style:font-style-complex="italic" /> 
  </style:style>
- <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
  <style:paragraph-properties text:number-lines="false" text:line-number="0" /> 
  <style:text-properties style:font-name-complex="Tahoma1" /> 
  </style:style>
- <text:outline-style>
- <text:outline-level-style text:level="1" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="2" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="3" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="4" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="5" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="6" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="7" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="8" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="9" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
- <text:outline-level-style text:level="10" style:num-format="">
  <style:list-level-properties text:min-label-distance="0.15in" /> 
  </text:outline-level-style>
  </text:outline-style>
  <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document" /> 
  <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0" /> 
  <text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5" /> 
  </office:styles>
- <office:automatic-styles>
- <style:page-layout style:name="pm1">
- <style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in">
  <style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:adjustment="left" style:rel-width="25%" style:color="#000000" /> 
  </style:page-layout-properties>
  <style:header-style /> 
  <style:footer-style /> 
  </style:page-layout>
  </office:automatic-styles>
- <office:master-styles>
  <style:master-page style:name="Standard" style:page-layout-name="pm1" /> 
  </office:master-styles>
  </office:document-styles>

manifest.xml nella directory meta-inf descrive la struttura del file XML.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manifest:manifest
	PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
<manifest:manifest
	xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">
 <manifest:file-entry
 	manifest:media-type="application/vnd.oasis.opendocument.text"
	manifest:full-path="/"/>
 <manifest:file-entry
 	manifest:media-type="application/vnd.sun.xml.ui.configuration"
	manifest:full-path="Configurations2/"/>
 <manifest:file-entry
 	manifest:media-type="" manifest:full-path="Pictures/"/>
 <manifest:file-entry
 	manifest:media-type="text/xml" manifest:full-path="content.xml"/>
 <manifest:file-entry
 	manifest:media-type="text/xml" manifest:full-path="styles.xml"/>
 <manifest:file-entry
 	manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
 <manifest:file-entry
 	manifest:media-type=""
	manifest:full-path="Thumbnails/thumbnail.png"/>
 <manifest:file-entry
 	manifest:media-type="" manifest:full-path="Thumbnails/"/>
 <manifest:file-entry
 	manifest:media-type="text/xml" manifest:full-path="settings.xml"/>
</manifest:manifest>

Altri file e cartelle possono essere inclusi nell'archivio, se necessari.

Note[modifica]

  1. Lo schema per i formati OpenDocument è disponibile all'indirizzo http://www.oasis-open.org/committees/download.php/12572/OpenDocument-v1.0-os.pdf