XMLForm Handling
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation

Concepts
Overview
Sitemap
Views
Caching
Actions
Matchers and Selectors
Entity Catalogs
MRUMemoryStore
Persistence
StoreJanitor
XMLSearching
XMLForm
Databases
Modules

Notice

This document is based on components included in the current Cocoon 2.1 distribution. If you do not have this version, you can obtain it from the Apache Cocoon web site. Be sure to look at the WARNING document that accompanies such pre-release versions.

Introduction

The XMLForm framework is inspired by Apache Jakarta Struts and W3C XForms.

Its goal is to:

  • Ease the development of sophisticated web applications utilizing complex data types and multi-page transactions
  • Provide an automated 2 way mapping between HTML Forms <-> XML <-> JavaBeans
  • Use standard XML schema languages like XML Schema, Relax-NG, Schematron for data validation
  • Promote complete reuse of Cocoon Actions for:
    • UI centric web applications - HTML, WML, UXL, VoiceML, etc.
    • Web Services (based on the REST paradigm)
    • Remote Portal Forms. (An interactive extension of static content formats like Netscape RSS)
  • Utilize XPath tools like Apache Jakarta Commons JXPath for read/write access to JavaBeans, DOM nodes and mixed objects.
  • Utilize the existing Cocoon XML functional testing framework - AntEater.

The current implementation offers the following features:

  1. Automated 2 way binding of HTML Forms to JavaBeans (and DOM nodes) through XPath
  2. Automatic validation of JavaBeans(and DOM nodes) through Schematron schemas
  3. Intermediate XForms like XML markup for form views
Background

The aim of XMLForm, is to build and edit an xml document (called the instance), subject to constraints from some schema (XMLSchema, Schematron, ...), through a sequence of form pages. The instance is either a dom-document or a Java bean-structure or a mix. XMLForm consist, of three main components:

  • Form - is responsible for the instance and validation of it. Form objects are stored in request attributes for one page forms and session attributes for wizards (multi page forms). A Form can be populated from the request parameters. This is the "model in MVC terms.
  • XMLFormTransformer - takes a form descriptor, (similar to XForms) as input and fill it with data and error messages from a Form object that is referred in an attribute. This is the "view" in MVC terms.
  • AbstractXMLFormAction, (WizardAction) - creates the Form object if necessary and populates it with data based on the request parameters. It can also take care of flow handling and checkbox state. This is the "controller" in MVC terms.
Demonstration

In version 2.1, see XMLForm in action with the by selecting: http://localhost:8080/cocoon/samples/xmlform/".

Further information

See the Cocoon XMLForm How-To

Please discuss Cocoon XMLForm on the mailing lists

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.