Cocoon - Apache's xml effort

This section describes one of the efforts at creating an XML based document server. While documents aren't ceXML's main focus, it is a handy way to extract information from XML files containing (for example) technical data and to format it automatically for presentation on the world wide web.


Apache is the dominant web server (60% of all sites run it), available for almost all platforms. Cocoon is part of the effort at creating a set of standards-based XML solutions. Cocoon is the part which provides the central XML server. It is implemented in Java with a very modular architecture, allowing for example a choice between various XML parsers. Most of the building blocks of have been donated by IBM, Sun and Oracle in order to integrate them into one powerful whole.

Working of cocoon

Cocoon, being programmed in Java, uses the Java Server Pages (JSP) mechanism. Every web server with JSP can redirect files with a specific extension (like .xml) to Cocoon, while serving normal HTML pages, images, etc. itself. According to processing instructions, Cocoon then routes the requested document through a series of transformation steps before presenting the information to the user. To name a possibility, it can start with an XML file containing SQL statements, it then queries the database, replacing SQL with the database results in XML tags, then transforms it using an XSL/T stylesheet into a readable XHTML file. Fairly quickly a way to integrate many existing scripting solutions into the Cocoon framework will be completed.

Possible use for ceXML

The possibility to use standard XML tools like XSL/T for transformations and XSL:FO for formatting into, say, pdf make Cocoon an attractive framework for a low-cost server side solution to use with ceXML. Though there is a choice of various parsers and processors, home-brewed solutions can be made and integrated fairly easily. When web server functionality is needed by ceXML, Cocoon can provide a quick initial solution, if not more.