Web Forms
Objective
Build a "simple" forms-oriented business application that generates printed
reports.
Two levels of data forms fill-in template for a printed report which is presently
a Word document.
Contents of forms control which data may appear in some forms.
Contents of forms control the layout of the report as well as fill-in fields.
Criteria
- Low Cost
- High Quality Appearance for Reports
- MacOS vs Windows
- Desktop
vs Web
- COTS vs
OSS
Alternatives
- FileMaker
- 4th Dimension
- Microsoft Office
Chosen Design
XML Schema
- XML Schema Part 0: Primer
http://www.w3.org/TR/xmlschema-0/
- XML Schema Part 1: Structures
http://www.w3.org/TR/xmlschema-1/
- XML Schema Part 2: Datatypes
http://www.w3.org/TR/xmlschema-2/
XML
Schema Part 0 (local link)
XML
Schema Part 1 Structures (local)
XML
Schema Part 2 Datatypes (local copy)
The purpose of XML Schema: Structures is to define the nature of
XML schemas and their component parts, provide an inventory of XML markup
constructs with which to represent schemas, and define the application
of schemas to XML documents.
The purpose of an XML Schema: Structures schema is to define and
describe a class of XML documents by using schema components to constrain
and document the meaning, usage and relationships of their constituent
parts: datatypes, elements and their content and attributes and their
values. Schemas may also provide for the specification of additional
document information, such as normalization and defaulting of attribute
and element values. Schemas have facilities for self-documentation. Thus,
XML Schema: Structures can be used to define, describe and catalogue
XML vocabularies for classes of XML documents.
The Schema
Castor
- http://castor.exolab.org/
- Castor
XML: Java object model to and from XML
- - Generate
source code from an XML Schema
- Castor's Source Code Generator creates a set
of Java classes which represent an object model for an XML Schema
(W3C XML Schema, 20010502 Recommendation)1, as well as
the necessary Class Descriptors used by the marshalling framework
to obtain information about the generated classes.
- Source Generator generates JavaBean classes from XML Schema Structures.
- XML Schema primitive types mapped to Java types.
Castor is an open source data binding
framework for Java[tm]. It's basically the shortest path between
Java objects, XML documents and SQL tables. Castor provides Java
to XML binding, Java to SQL persistence, and then some more.
Castor docs
(local copy)
Source
Generator type mapping
The Generated JavaBeans
Help Needed for JavaBeans
- JavaBean classes generated by Castor Source Generator use the default
class initializer which leaves all fields null.
- Can't read/write classes which violate minOccurs.
- JXPath can't (easily) fill in missing complexTypes.
- Need helper classes for new and init.
- Don't write by hand, generate from XML Schema.
- Use XQuery.
XQuery
- XQuery is especially nice syntax for processing XML trees.
- Similar to XSLT but functionally-oriented rather than pattern-oriented.
- Qexo (Kawa, the Java-based Scheme) is an (incomplete) XQuery implementation
- http://www.gnu.org/software/qexo/
Qexo
(local copy)
JavaBeans Helper Script
Helper
Generator Script
Cocoon 2 XMLForm
Cocoon
Cocoon User
Documentation
XML Form from XML Schema
XSL
- W3C Style Activity
- http://www.w3.org/Style/
- XSL Transformations (XSLT)
- XSL Formatted Output (XSL or XSL-FO)
- Cascading Style Sheets (CSS)
The Extensible Stylesheet Language (XSL) is a language for expressing
stylesheets. It consists of two parts:
-
a language for transforming XML documents (XSLT), and
-
an XML vocabulary for specifying formatting semantics (XSL-FO).
An XSL stylesheet specifies the presentation of a class of XML documents
by describing how an instance of the class is transformed into an XML document
that uses the formatting vocabulary.
Many of the formatting attributes in XSL-FO are in common with CSS2. That
enables the possibility of having some automatic translation of XSL to CSS.
That would be very useful in publishing XHTML documents in both screen-oriented
and printed forms.
XSL
Overview (local copy)
XSLT
XPath
- http://www.w3.org/TR/xpath
- XPath is a language for addressing parts of an XML document, designed
to be used by both XSLT and XPointer.
XSL-FO
XSL
Overview (local copy)
FOP docs (local copy)
Rich XSL Example
Hammer
XML
FOP Tests
Lessons Learned
- Recompilation of Java application to change schema very inconvenient.
- Would try Xindice next time.
W3C XForms
XForms is an XML application that represents the next generation of forms
for the Web. By splitting traditional XHTML forms into three parts—XForms
model, instance data, and user interface—it separates presentation from content,
allows reuse, gives strong typing—reducing the number of round-trips to the
server, as well as offering device independence and a reduced need for scripting.
XForms is not a free-standing document type, but is intended to be integrated
into other markup languages, such as XHTML or SVG.
XForms
(local copy)
Future Possibilities
- XForms 1.0 for Cocoon XML Form.
- Extend the XML Schema-to-XML Form support to work with any schema.
- Turnkey Web Form application server configured via web forms .