[odf-discuss] minimal instance of ODF document; relationship to validity and what is generated from the odfpy library

Raymond Yee raymondyee at mashupguide.net
Tue Jun 5 14:29:22 EDT 2007


Hi everyone,

My name is Raymond Yee -- and I'm new to this list.  I'm currently 
writing a book about web/data mashups (http://blog.mashupguide.net) and 
am working on a chapter on desktop and online office suites.  I am 
working on a section that describes how to get started with ODF and am 
looking for some help.

I would agree that a good practical way to get started with ODF is to 
run OpenOffice.org (say v 2.2 -- which is what I'm running on Windows 
XP), fire up Writer, type in "Hello World!", save the file, unzip it and 
study the files that result and their structures.  I would, like, 
however, to identify what would be a *minimal* instance of an ODF file 
(say .odt specifically).  From what I read in J. David Eisenberg's book 
(://books.evc-cit.info/OD_Essentials.pdf -- p. 13) or 
http://develop.opendocumentfellowship.org/book/?page=ch2 -- "The only 
files that are actually necessary are content.xml and the 
META-INF/manifest.xml file".  I set out to verify this.  I generated an 
odt with just those two files -- 
http://examples.mashupguide.net/ch17/helloworld_min_odt_1.odt   I found 
this file loads ok in OO.o and the ODF Viewer 
(http://opendocumentfellowship.org/odfviewer) on Windows, at least.  
However, the ODF validator doesn't like it.  I get the following 
warning/errors:

   1. warning

      does not contain a /mimetype file. This is a SHOULD in
      OpenDocument 1.0

   2. error

      styles.xml is missing

   3. error

      settings.xml is missing

   4. error

      meta.xml is missing


So I generated another odt 
(http://examples.mashupguide.net/ch17/helloworld_min_odt_2.odt) -- which 
the validator likes more (I purposely left out the mimetype since the 
validator says it's not strictly required).

My questions are then:

1) What is actually the correct answer to what is required for a valid 
ODF document?  just content.xml and METAINF/manifest.xml ?  or more?
2) Is that requirement actually mandated by the Relax NG schema or is it 
in the "human documentation"?

I went on to try out odfpy (the June 4 svn version) and wrote:

from odf.opendocument import OpenDocumentText
from odf.text import P

textdoc = OpenDocumentText()
p = P(text="Hello World!")
textdoc.text.addElement(p)
textdoc.save("helloworld_odfpy.odt")

OO.o and the ODF Viewer were happy with the output.  The Validator 
complained:

   1. error

      in styles.xml
      Did not expect element styles there
      Element document-styles has extra content: styles

   2. error

      in settings.xml
      Expecting an element , got nothing

Furthermore, I have no luck get OpenDocumentPHP to work for me.  Maybe 
something wrong in my setup.

Thanks in advance,
-Raymond

-- 
-- 
Raymond Yee, Ph.D.                      102 South Hall
Lecturer                                UC Berkeley
School of Information                   Berkeley, CA 94720-4600
raymond.yee at gmail.com                   raymondyee at mashupguide.net
http://blog.dataunbound.com             http://blog.mashupguide.net         



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opendocumentfellowship.com/pipermail/odf-discuss/attachments/20070605/eaeb958b/attachment-0001.html


More information about the odf-discuss mailing list