Monday, December 26, 2011

Simplify with an XML data model - Introduction


A system for XML data binding in the browser with XPath and client side validation using Schematron and XSLT.


Introduction

As a Java developer I find myself wondering why I spend so much time dealing with data models. For each application I work on, my time is mostly spent creating a data model in the database, a corresponding data model business object in Java code, and form value objects to collect data from web pages. Then I have to write the code that copies all the fields between models. Then there is the problem of validation rules, which require yet another framework.
After working with web services and JAXB, I started to wonder if there was an easier and more flexible way of representing all of this data in XML and skipping all the myriad Java data model classes. It turns out that XML makes for a great data model. It can represent any type of data, is easy to write, access, transform and exchange. It’s the X in AJAX for crying out loud!

XML, being a standard, is also great because there are hundreds of applications that utilize it. XML has several great languages for defining structure, such as DTD, XML Schema (XSD), and RELAXNG. It also has some great languages for validation assertions like Schematron and the
latest Schema 1.1 candidate. This is important, since it allows for a single data dictionary source of record that can drive remoting interfaces such as WSDL, database column definitions, and validation at the same time. XML also has a standard language, XPath, for selecting XML nodes and computing values. These standards combined make for a data binding and validation approach that hopefully is simple, easy to use, requires minimal effort, and uses existing standards.



Part 1 - Basic Binding from the HTML form to XML
Part 2 - Bidirectional data binding
Part 3 - Ensuring node path
Part 4 - Data validation using Schematron and XSLT

No comments:

Post a Comment