ODFDOM

The ODFDOM project's objective is to provide an API for easily reading, writing and manipulating ODF documents.

See:
          Description

Packages
org.odftoolkit.odfdom.doc The "Document Layer" exisit for usability reasons, the various Odf document types belong to this package.
org.odftoolkit.odfdom.doc.element Initially from the ODF RelaxNG generated Java classes, representing components consistent of multiple ODF elements (e.g.
org.odftoolkit.odfdom.doc.element.anim  
org.odftoolkit.odfdom.doc.element.chart  
org.odftoolkit.odfdom.doc.element.config  
org.odftoolkit.odfdom.doc.element.db  
org.odftoolkit.odfdom.doc.element.dc  
org.odftoolkit.odfdom.doc.element.dr3d  
org.odftoolkit.odfdom.doc.element.draw  
org.odftoolkit.odfdom.doc.element.form  
org.odftoolkit.odfdom.doc.element.math  
org.odftoolkit.odfdom.doc.element.meta  
org.odftoolkit.odfdom.doc.element.number  
org.odftoolkit.odfdom.doc.element.office  
org.odftoolkit.odfdom.doc.element.presentation  
org.odftoolkit.odfdom.doc.element.script  
org.odftoolkit.odfdom.doc.element.style  
org.odftoolkit.odfdom.doc.element.svg  
org.odftoolkit.odfdom.doc.element.table  
org.odftoolkit.odfdom.doc.element.text  
org.odftoolkit.odfdom.doc.element.xforms  
org.odftoolkit.odfdom.dom  
org.odftoolkit.odfdom.dom.element  
org.odftoolkit.odfdom.dom.element.anim  
org.odftoolkit.odfdom.dom.element.chart  
org.odftoolkit.odfdom.dom.element.config  
org.odftoolkit.odfdom.dom.element.db  
org.odftoolkit.odfdom.dom.element.dc  
org.odftoolkit.odfdom.dom.element.dr3d  
org.odftoolkit.odfdom.dom.element.draw  
org.odftoolkit.odfdom.dom.element.form  
org.odftoolkit.odfdom.dom.element.math  
org.odftoolkit.odfdom.dom.element.meta  
org.odftoolkit.odfdom.dom.element.number  
org.odftoolkit.odfdom.dom.element.office  
org.odftoolkit.odfdom.dom.element.presentation  
org.odftoolkit.odfdom.dom.element.script  
org.odftoolkit.odfdom.dom.element.style  
org.odftoolkit.odfdom.dom.element.svg  
org.odftoolkit.odfdom.dom.element.table  
org.odftoolkit.odfdom.dom.element.text  
org.odftoolkit.odfdom.dom.element.xforms  
org.odftoolkit.odfdom.dom.style Provides classes to create and access ODF styles and ODF style families.
org.odftoolkit.odfdom.dom.style.props Classes representing the style properties.
org.odftoolkit.odfdom.dom.type  
org.odftoolkit.odfdom.dom.type.anim  
org.odftoolkit.odfdom.dom.type.chart  
org.odftoolkit.odfdom.dom.type.config  
org.odftoolkit.odfdom.dom.type.db  
org.odftoolkit.odfdom.dom.type.dr3d  
org.odftoolkit.odfdom.dom.type.draw  
org.odftoolkit.odfdom.dom.type.fo  
org.odftoolkit.odfdom.dom.type.form  
org.odftoolkit.odfdom.dom.type.meta  
org.odftoolkit.odfdom.dom.type.number  
org.odftoolkit.odfdom.dom.type.office  
org.odftoolkit.odfdom.dom.type.presentation  
org.odftoolkit.odfdom.dom.type.smil  
org.odftoolkit.odfdom.dom.type.style  
org.odftoolkit.odfdom.dom.type.svg  
org.odftoolkit.odfdom.dom.type.table  
org.odftoolkit.odfdom.dom.type.text  
org.odftoolkit.odfdom.dom.type.xlink  
org.odftoolkit.odfdom.dom.util  
org.odftoolkit.odfdom.pkg Representing the "Package Layer", the physical document handling.
org.odftoolkit.odfdom.pkg.manifest  

 

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 ODFDOM Layers


The ODF Package / Physical Layer

At this level, a document is represented as a package of named resources. For standardized file streams explicit methods are being provided. The file streams are similar for all ODF documents. The main requirements for this layer are: All sources of the Package/Physical layer are organized beyond org.odftoolkit.odfdom.pkg.*

The ODF Typed DOM / XML Layer

At this level, all XML file streams of the document are accessible via the W3C DOM API, but only the ODF standardized XML file streams of the document their own classes representing their ODF XML. Foreign XML within a specified ODF file remains in general in the document model and won't be neglected unless desired ( which might be a future option). For instance the following pictures shows the mapping of a XML structure of an ODF table to a W3C derived ODF DOM class structure.


xml structure


ODF DOM class structure

All sources of the typed DOM/XML layer are organized beyond org.odftoolkit.odfdom.dom.* Its sources are all generated from the ODF RelaxNG schema using the following naming conventions:

Note: The element local names 'h' and 'p' have been renamed to the classes 'Heading' and 'Paragraph' For instance, the frame element 'draw:frame' would be generated as class org.odftoolkit.odfdom.dom.draw.OdfFrameElement
Note: Java dependent helper classes, which are not part of the official API, but for convenient part of the module are delivered beyond org.odftoolkit.odfdom.java.* The following example illustrates how to add a graphic to the ODF document, that it is viewable:

The ODF Document / Convenient Functionality Layer

The purpose of a class from the convenient layer is a higher usability for the API user. Usually a class is derived from covered XML layered class. All sources of the ODF document / convenient functionality layer are organized beyond org.odftoolkit.odfdom.doc.* The name of a convenient class is similar as it's XML parent, only the suffix 'Element' has been neglected. for instance, a convenient class for a frame, derived from the class representing 'draw:frame' would be named org.odftoolkit.odfdom.doc.draw.OdfFrame In contrary to the classes of the XML layer, an object of the convenient layer controls multiple XML elements. For instance, a default table consisting of the similar amount of the earlier mentioned table can be created by a single method call, instead creating every single element using directly the XML layer.

The Customized ODF Document / Extendable Layer

Although not part of the ODFDOM package it is designed as a layer on top of ODFDOM, where customer are able to replace/overwrite/customize ODF elements. For instance, change the default size/style of their new tables.

Class Diagram


(click for full view in a new window)

Further Information

For further Information about ODFDOM and related topics please visit following pages:
  • ODFDOM wiki
  • ODF Specification 1.1


  • Copyright © 2009. All Rights Reserved.