OASIS Opendocument Essentials Using OASIS Opendocument XML
Total Page:16
File Type:pdf, Size:1020Kb
OASIS OpenDocument Essentials Using OASIS OpenDocument XML J. David Eisenberg Cover graphic provided by Peter Harlow OASIS OpenDocument Essentials: Using OASIS OpenDocument XML by J. David Eisenberg Copyright © 2005 J. David Eisenberg. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in Appendix D, “GNU Free Documentation License”. Published by Friends of OpenDocument Inc., P.O. Box 640, Airlie Beach, Qld 4802, Australia, http://friendsofopendocument.org/. This book was produced using OpenOffice.org 2.0.1. It is printed in the United States of America by Lulu.com (http://www.lulu.com). The author has a web page for this book, where he lists errata, examples, or any additional information. You can access this page at: http://books.evc-cit.info/index.html . You can download a PDF version of this book at no charge from that website. The author and publisher of this book have used their best efforts in preparing the book and the information contained in it. This book is sold as is, without warranty of any kind, either express or implied, respecting the contents of this book, including but not limited to implied warranties for the book’s quality, performance, or fitness for any purpose. Neither the author nor the publisher and its dealers and distributors shall be liable to the purchaser or any other person or entity with respect to liability, loss, or damages caused or alleged to have been caused directly or indirectly by this book. All products, names and services mentioned in this book that are trademarks, registered trademarks, or service marks, are the property of their respective owners. ISBN 1-4116-6832-4 Table of Contents Table of Contents Preface......................................................................................................... vii Who Should Read This Book?............................................................................ vii Who Should Not Read This Book?..................................................................... vii About the Examples............................................................................................ vii Conventions Used in This Book.........................................................................viii Acknowledgments.............................................................................................. viii Chapter 1. The Open Document Format....................................................1 The Proprietary World...........................................................................................1 The OpenDocument Approach..............................................................................2 Inside an OpenDocument file................................................................................ 2 File or Document?........................................................................................... 2 The manifest.xml File............................................................................................6 Namespaces........................................................................................................... 7 Unpacking and Packing OpenDocument files....................................................... 9 The Virtues of Cheating...................................................................................... 12 Chapter 2. The meta.xml, styles.xml, settings.xml, and content.xml Files.............................................................................................................. 13 The settings.xml File........................................................................................... 13 Configuration Items....................................................................................... 13 Named Item Maps..........................................................................................14 Indexed Item Maps........................................................................................ 14 The meta.xml File................................................................................................14 The Dublin Core Elements............................................................................ 17 Elements from the meta Namespace..............................................................18 Time and Duration Formats...........................................................................20 Case Study: Extracting Meta-Information...........................................................20 Archive::Zip::MemberRead...........................................................................20 XML::Simple.................................................................................................21 The Meta Extraction Program........................................................................22 The styles.xml File...............................................................................................24 Font Declarations...........................................................................................24 Office Default and Named Styles.................................................................. 25 Names and Display Names............................................................................ 26 The content.xml File............................................................................................27 Chapter 3. Text Document Basics............................................................. 29 Characters and Paragraphs.................................................................................. 29 Whitespace.....................................................................................................29 Defining Paragraphs and Headings................................................................33 Character and Paragraph Styles..................................................................... 33 Creating Font Declarations.......................................................................34 Using OASIS OpenDocument XML i Table of Contents Creating Automatic Styles........................................................................36 Character Styles........................................................................................36 Using Character Styles............................................................................. 38 Paragraph Styles.......................................................................................40 Borders and Padding................................................................................ 41 Tab Stops..................................................................................................42 Asian and Complex Text Layout Characters................................................. 43 Case Study: Extracting Headings...................................................................44 Sections................................................................................................................46 Pages....................................................................................................................48 Specifying a Page Master...............................................................................49 Master Styles..................................................................................................52 Pages in the content.xml file..........................................................................53 Bulleted, Numbered, and Outlined Lists............................................................. 53 Case Study: Adding Headings to a Document.....................................................57 Chapter 4. Text Documents—Advanced.................................................. 69 Frames................................................................................................................. 69 Style Information for Frames.........................................................................69 Body Information for Frames........................................................................ 70 Inserting Images in Text...................................................................................... 71 Style Information for Images in Text.............................................................72 Body Information for Images in Text............................................................ 73 Background Images............................................................................................. 74 Fields................................................................................................................... 74 Date and Time Fields.....................................................................................74 Page Numbering............................................................................................ 75 Document Information...................................................................................75 Footnotes and Endnotes.......................................................................................75 Tracking Changes................................................................................................ 77 Tables in Text Documents...................................................................................79 Text Table Style Information.........................................................................79 Styling for the