ODF Toolkit

repository·master·Indexed 40 days ago

https://github.com/tdf/odftoolkit

A lightweight Java-based suite for the programmatic manipulation, validation, and XSLT processing of Open Document Format (ODF) files, optimized for server-side environments. It includes ODFDOM for API-based document access, ODF Validator for conformance checking, ODF XSLT Runner for applying stylesheets to XML streams, and the schema2template generator for automating Java source code creation from XML schemata.

Tokens
5.3K
Snippets
13
Records
41
Agent score
98%

What's inside ODF Toolkit

  1. Overview of ODF Validator

    master

    ODF Validator is a tool designed to validate OpenDocument files and verify them against specific conformance criteria. It is highly versatile and can be integrated into different environments in three primary ways:

    1. Java Library: For embedding validation logic directly into your Java applications.
    2. Command Line Interface (CLI): For standalone validation tasks via the terminal.
    3. Web Application Archive (WAR): For deployment as a web application.
  2. Overview of the ODF Toolkit components

    master

    The ODF Toolkit is a set of Java modules designed for the programmatic creation, scanning, and manipulation of Open Document Format (ODF) documents. It is lightweight and optimized for server-side use, avoiding the need for heavy-weight desktop editors.

    The toolkit consists of four main subcomponents:

    1. ODFDOM (odfdom-java-*.jar): The core ODF framework providing a common API to create, access, and manipulate ODF files without requiring deep knowledge of the ODF specification.
    2. Simple API (simple-odf-*.jar) [DEPRECATED]: A high-level Java API for ODF 1.2 documents. It acts as an abstraction over the lower-level ODFDOM API.
    3. ODF Validator (odfvalidator-*.war): A tool to validate ODF files for conformance to the ODF Standard. It is available as an online service and a command-line tool.
    4. ODF XSLT Runner (xslt-runner-*.jar, xslt-runner-task-*.jar): A Java application that applies XSLT stylesheets to XML streams within ODF packages without needing to extract them. It can be used via CLI or as an Ant task.
  3. Overview of the schema2template Generator

    master

    The schema2template library is a tool designed to load arbitrary XML schemata (such as RelaxNG, DTD, or W3C XML Schema) and convert them into a powerful grammar model based on RelaxNG XML. Once the XML model is loaded, the library can be used to fill user-defined template files with data.

    In the context of the ODF Toolkit, this generator is used to create the XML layer. It maps every XML element and attribute from the grammar to specific Java classes within the ODFDOM project:

    • ODF attributes: Located in org.odftoolkit.odfdom.dom.attribute
    • ODF elements: Located in org.odftoolkit.odfdom.dom.element
  4. Overview of the ODFDOM Java Library

    master
    ODFDOM is an OpenDocument Format (ODF) framework designed to provide a common, easy-to-use API for creating, accessing, and manipulating ODF files. It abstracts the complexities of the ODF specification, allowing developers to work with ODF documents without needing deep knowledge of the underlying format. While designed to be portable to any object-oriented language, the current reference implementation is written in Java.
  5. Overview of schema2template

    master

    The schema2template project is a tool designed to load XML schemas (including DTD, W3C schema, and RelaxNG) and use the information extracted from them to populate Apache Velocity engine text templates.

    It is primarily used by ODFDOM to automate the generation of Java source code that represents ODF XML elements and XML attributes for the DOM layer.

  6. Overview of the Taglets Java Library

    master
    The Taglets Java Library is a sub-project of the ODF Toolkit designed to enhance Javadoc generation for ODFDOM. It provides custom Javadoc tags that link generated Java classes (representing ODF XML elements, attributes, and types) directly to their corresponding anchors in the official ODF specification (HTML).
  7. About ODF XSLT Runner

    master
    ODF XSLT Runner is a Java command-line application designed to apply XSLT stylesheets to XML streams contained within ODF (OpenDocument Format) packages. A key feature is that it can process these XML streams directly without requiring the user to manually extract them from the package first.
  8. JDK compatibility and API changes for Taglets

    master

    The Taglet API implementation differs depending on the JDK version used:

    • JDK 8: Relies on tools.jar for Taglet functionality.
    • JDK 9 and later: Uses the standard Java API, as tools.jar is considered an implementation detail and is no longer required/provided in the same way.
  9. How schema2template architecture works

    master

    The schema2template library integrates two primary open-source engines to achieve its functionality:

    1. Multi Schema Validator (MSV): Handles the ingestion of various XML schema formats and maps them to an internal RelaxNG model.
    2. Apache Velocity Template Engine: Serves as the templating framework, allowing for scripting and logic within the template files used to generate output.

    By combining these, the library supports several common use cases for a given XML schema (RelaxNG, DTD, or W3C schema):

    • Generating XML node references for the format in HTML.
    • Generating Java source code for a typed DOM tree representing the format.
  10. Taglet types for ODF elements, attributes, and types

    master

    The library provides three distinct categories of taglets to ensure accurate documentation linking:

    1. ODF Elements: Tags for classes representing XML elements.
    2. ODF Attributes: Tags for classes representing XML attributes.
    3. ODF Types: Tags for classes representing ODF data types.