XML - 資料交換管理/OpenOffice.org 和 OpenDocument 格式
XML - 資料交換管理
|
相關主題
|
參與進來
|
| 上一章 | 下一章 |
| ← XMLWebAudio | 谷歌地球 → |
學習目標
|
OpenOffice.org 正如其名稱所暗示的那樣:一個開源辦公應用套件。它基於 Sun Microsystems 的 StarOffice 的原始碼,該原始碼於 2000 年捐贈給了開源社群。OpenOffice.org 可以讀取和儲存其他辦公應用程式使用的多種格式的檔案,但其預設格式是 OpenDocument,這是一種由 OASIS(結構化資訊標準促進組織)標準化的 XML 格式。由於這兩個因素,一個開源編輯器和基於 XML 的檔案,OpenOffice.org 有望在不久的將來變得非常重要,因為國家政府(尤其是歐盟)正在繼續趨勢,要求所有電子政府檔案以開源格式儲存。
如介紹中所述,OpenDocument 是一種由 OASIS 標準化的 XML 格式。OpenDocument 檔案採用壓縮 zip 存檔的形式,具有以下副檔名之一
- .odt(文字)
- .ott(文字模板)
- .odm(主文件)
- .oth(HTML 模板)
- .ods(電子表格)
- .ots(電子表格模板)
- .odg(繪圖)
- .otg(繪圖模板)
- .odp(簡報)
- .otp(簡報模板)
- .odf(公式)
- .odb(資料庫)
(注意,所有這些副檔名僅限於 2.0 版)
zip 存檔包含以下檔案和目錄(來自 OpenOffice.org 幫助文件)
- 文件的實際文字儲存在 content.xml 中。預設情況下,這是文件的簡化版本,它省略了諸如縮排或換行符之類的格式元素,以簡化儲存和開啟文件。
content.xml 示例
<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 包含文件的元資訊,可以在“檔案 - 屬性”中進行編輯。如果文件使用密碼儲存,則 meta.xml 將不會被加密。
meta.xml 示例
<?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 包含有關此文件設定的更多資訊。
settings.xml 示例
<?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 包含應用於文件的樣式,這些樣式可以在“樣式和格式”視窗中看到。
styles.xml 示例
<?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>
|
- meta-inf 目錄中的 manifest.xml 描述了 XML 檔案的結構。
manifest.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>
|
- 如果需要,存檔中可能包含其他檔案和資料夾。
OpenDocument 格式的模式可以在 http://www.oasis-open.org/committees/download.php/12572/OpenDocument-v1.0-os.pdf 找到(注意:706 頁)。
OpenOffice 包含 WRITER,它是 OpenOffice.org 的文字處理器。CALC 是一個功能強大的電子表格,它擁有計算、分析、彙總和展示資料所需的所有工具。IMPRESS 是一種快速而強大的方法,可以建立有效的多媒體簡報。DRAW 可以製作從簡單的圖表到動態 3D 插圖和特殊效果的任何內容。BASE 是 2.0 版的新功能,它使您能夠在 OpenOffice.org 中無縫地操作資料庫資料。它允許建立和修改表格、表單、查詢和報表。
下載地址:http://download.openoffice.org/
政府和企業領導人開始意識到開源文件格式的重要性,並開始採取行動。2005 年 7 月,挪威現代化部長莫頓·A·邁耶提出了挪威資訊科技計劃,名為“eNorge——數字飛躍”,其中涵蓋了開放標準和開源。邁耶對開放標準和開源的目標如下:
- 在 2009 年之前,公共部門的所有新 ICT 和資訊系統都應使用開放標準。
- 在 2006 年之前,應建立一套用於資料和文件交換的管理/行政標準。
- 在 2006 年之前,公共部門的所有業務都應制定使用開放標準、面向服務的架構和開源的計劃。
- 在 2008 年之前,公共部門的所有資料和文件交換都應符合管理/行政標準。
- 在 2008 年之前,所有公共表格都應建立在通用介面上。
此外,邁耶說:“在公民和政府之間的通訊中,不再接受專有格式。”
在美國,IBM 標準和開源副總裁鮑勃·蘇託在自己的部落格中,作為“Open Document 行動承諾”的一部分,向用戶提出了以下建議:
- 今天就要求您辦公室應用程式(文字處理器、電子表格、簡報軟體)的提供商承諾在 2007 年 1 月 1 日之前在其產品中支援 OASIS OpenDocument for Office Applications 標準。
- 今天就要求您部署的辦公室應用程式允許使用者輕鬆地將 OASIS OpenDocument 標準設定為文件的預設“儲存”格式。也就是說,您不應該為了避免使用專有格式而費太多工夫。
- 讓您的辦公室應用程式提供商承諾加入並參與 OASIS OpenDocument 標準技術委員會。
- 詢問您的資訊長何時能夠使用支援 OASIS OpenDocument 標準的辦公室應用程式。
- 詢問您當地的和聯邦政府何時將支援 OASIS OpenDocument 標準。
- 堅持使用任何 XML 文件格式,這些格式不受專有擴充套件的限制,並且該格式對任何人免費使用,不受限制,包括使用 GPL 許可證的開源社群。確保如果實施者必須接受涵蓋該格式的許可證,則該許可證在這些重要問題上清晰明確。
- “這些是您的文件:您應該能夠隨時隨地使用任何您想使用的應用程式對它們進行任何操作。”
意義很明確。計算世界正在朝著開源軟體和檔案型別邁進,以進行資訊交換,尤其是在商業和政府領域,而 OpenOffice.org 憑藉其基於 XML 的格式,將處於領先地位。
http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office
http://www.sun.com/software/star/staroffice/index.jsp
“挪威部長表示,所有公共部門都需要在 2005 年之前制定開源使用計劃。”Europa—IDABC。2005 年 7 月 6 日。 http://ec.europa.eu/idabc/en/document/4403/469.
鮑勃·蘇託。“開放標準、開源、開放思想、開放機遇。”IBM developerWorks。2005 年 10 月 11 日。 http://www-128.ibm.com/developerworks/blogs/dw_blog_comments.jspa?blog=384&entry=97126.
“XML 檔案格式。”幫助文件,Sun Microsystems, Inc., OpenOffice.org 2.0 版,2000-2005 年。