Difference between revisions of "ODFDOM"

From Apache OpenOffice Wiki
Jump to: navigation, search
(The Package Layer)
 
(132 intermediate revisions by 6 users not shown)
Line 1: Line 1:
=OpenDocument API - ODFDOM=
+
The OpenDocument API has a new home. Please visit
 +
http://odftoolkit.org/projects/odfdom/pages/Home
  
ODFDOM is the name of the upcoming free OpenDocument framework sponsered by Sun Microsystems Inc.  
+
You should register at the ODF Toolkit project and subscribe yourself to the mailing lists of the projects you are interested in.
  
It is the succesor of [[AODL]] and [[Odf4j]], designed together with their architects to provide the ODF developer community an easy lightwork programming API, meant to be portable to any object-oriented language.
+
See you soon,
 
+
Svante
The first pre-version of the Java 5 reference implementation of ODFDOM is planned to be made public under LGPL3 in May 2008.
+
[[Category:ODFToolkit]]
 
+
=Overview=
+
 
+
The ODFDOM project's objective is to provide an API for easily reading, writing and manipulating ODF documents. ODFDOM implements a layered approach through which documents are accessed.
+
* The ODF Package / Physical Layer - provides direct access to the resources that are stored in the ODF package, such as XML streams, images or embedded objects.
+
* The ODF Typed DOM / XML Layer - provides classes for all XML elements. XML attributes are mapped to class attributes. It is a typed DOM as every ODF XML element is represented by a different class, generated from the ODF RelaxNG schema. This level is concerned with the representation of the content of the standardized XML streams of the underlying package using the language independent W3C DOM API. This layer easily provides the ODF developer with all informations about the ODF XML structure.
+
* The ODF Document / Convenient Layer - represents components consisting of multiple underlying XML elements. This level is concerned with usability aids, which are not specified by the ODF standard.
+
* The Customized ODF Document / Extendable Layer - not part of the delivered API, but part of the design. This level is concerned with user defined customizations.
+
 
+
[[Image:ODFDOM-Layered-Model.png]]
+
 
+
ODFDOM is part of the [http://odftoolkit.openoffice.org odftoolkit project]. Development is discussed on the [http://odftoolkit.openoffice.org/servlets/SummarizeList?listName=dev dev@odftoolkit.openoffice.org mailing list].
+
 
+
=The ODFDOM Layers=
+
 
+
==The Package Layer==
+
 
+
At this level, a document is represented as a package of named resources. All resources can be accessed as streams.
+
Resources that are XML can additionally be accessed as DOM documents. For standardized file streams explicit methods are being provided.
+
 
+
[[Image:ODF_Package.jpg]]
+
Note:
+
All file streams aside of the /Pictures directory are specified by the ODF standard.
+
 
+
The main requirements for this layer are
+
* Zip/unzip the file streams of the package
+
* Enlist all file streams in the /META-INF/manifest.xml (otherwise OOo won't save the file streams)
+
* Begin the package with an unzipped 'mimetype' file stream
+
 
+
The following example illustrates how to access documents on the package level:
+
<pre>
+
import org.openoffice.odf.pkg.OdfPackage;
+
[...]
+
 
+
// loads the ODF document package from the path
+
OdfPackage pkg = OdfPackage.load("/home/myDocuments/myVacation.odt");
+
 
+
 
+
// loads the image from the URL and inserts the image in the package, adapting the manifest
+
pkg.insert("http://myweb.org/images/myHoliday.png", "/Pictures/myHoliday.png");
+
</pre>
+

Latest revision as of 19:37, 20 March 2010

The OpenDocument API has a new home. Please visit http://odftoolkit.org/projects/odfdom/pages/Home

You should register at the ODF Toolkit project and subscribe yourself to the mailing lists of the projects you are interested in.

See you soon, Svante

Personal tools