XML for Forms
Micah Dubinko
Brain Attic, L.L.C.
What is XML? What is a form?
- A structured exchange of data
- Not as many options as a "blank page"
- Decisions about structure reflect business processes
- Used to be called "Paperwork Simplification"
For example, a 'vacation time off' form typically wouldn't ask for your credit card number,
because the business process typically wouldn't involve that information.
Documents or Data (or Both)
- Many times, the information passed around through forms is itself XML
- Example: Universal Business Language (UBL)
- Might require some server-side preparation
- Tons of other examples. If it's XML and not pathologically misdesigned, you can probably use it
So beware: some vendors try to play up interop at this level, but it means little.
Auto vendors don't advertise "compatible with all paved roads", etc.
Data or Documents
- A form Definition Language is a good candidate for XML representation
- XHTML and XForms are the main examples
- But beware: XML doesn't mean "standard", nor does mere appearance on the W3C site
- Recursion is possible: the form can be the form payload!
In fact, "standard" means very little these days.
Schema Languages
- XML Schema is the W3C-backed language, and tied into XForms
- Relax NG, however, is much easier to work with, and can be converted
- Another option: Schematron for assertion-based validation
- XSLT can also be used in schema-like ways
XSLT
- A transformation language: from one "flavor" of XML to another
- Example: from UBL to XHTML for display
- Suported in most browsers
- Also commonly used on the server
- Builds on the foundation of XPath
XPath
- Instructions for navigating within XML, much like navigating a filesystem
- Includes basic math and string operations
- Used within XForms, XSLT, XPointer, and XML Signature
- XForms extends, to add date/time capabilities and more
HTML and friends
- HTML 4.01 (SGML)
- XHTML 1.0 (XML)
- XHTML 1.1 tightened up
- XHTML 2.0 with some significant changes; includes XForms
- "Modularization" is a toolkit to mix and match your own derivative vocabulary
- Add-on specifications: XML Events, XFrames
Graphics
- Scalable Vector Graphics (SVG) increasingly integrated with forms
- Allows for custom-drawn form controls
- Resolution-independent
- Increasingly popular on handheld devices
Metadata
- RDF and RDF Schema
- Ontologies
- XHTML 2.0 includes powerful tools based on <meta>
Finally, forms
- XForms 1.0 is final
- XForms 1.1 is under development
- Uses XML Schema, XPath, and XML Events
- reduced focus on scripting
Forms Engines
- See Top 10 XForms Engines
- Notable are OpenOffice and Mozilla
- Server-side engines possible: Chiba and Orbeon
- IE-support possible through plugin or native (JavaScript) implementation
Tools
- IE or Mozilla can check basic well-formedness
- libxml has command-line tools like xmllint
- W3C online Validator tools
(validator.w3.org)
- XForms Validator (xformsinstitute.com)
...Questions?
Ask micah@dubinko.info