Lech,
If you are going to use XForms, and I'd recommend it for the case you describe, then you shouild, depending on how you want to serve-up the forms, use either a server-side XForms implementation like Orbeon or betterForms, otherwise you should look at XSLTForms or Formular if you want to do things client-side.Depending upon how the schemas are constructed it is not too difficult to transform (XSLT) from an XML Schema into XForms and for validation you can either take one of two approaches:1) Use Schema Validation within the XForms, then you get validation on the spot (structure and values).2) Depending on the amount and type of validation (values only) you could generate XForms constraints that will provide validation of user input.The former you get for free with XForms, the latter you have to generate as part of the transformation.> but it looks like XForms are still not natively supported in the> browsers so I think not much has changes in recent years and> we'll have to generate HTML Forms from the schema.Have a good long look at the implementations page on the XForms Wiki:Native support there may not be but there has been considerable movement amongst both client-side and server-side implementations, many (if not all) supporting a lot of XForms 1.1 features and also adding XPath 2 which is very handy for constraint expressions.If you go down the XForms route you'll save yourself a lot of hassle in the long run compared to trying to re-invent the same features with HTML Forms, JavaScript and server-side code. After all, the majority of the XForms implementations that deliver HTML Forms + JavaScript have, in effect, done all that work for you.Regards
Philip Fennell
Consultant
MarkLogic Corporation
Mobile +44 (0) 7824 830 866
email Philip.Fennell@marklogic.com
web www.marklogic.com
This e-mail and any accompanying attachments are confidential. The information is intended solely for the use of the individual to whom it is addressed. Any review, disclosure, copying, distribution, or use of this e-mail communication by others is strictly prohibited. If you are not the intended recipient, please notify us immediately by returning this message to the sender and delete all copies. Thank you for your cooperation.
From: Lech Rzedzicki [xchaotic@gmail.com]
Sent: 08 October 2010 14:58
To: xml-dev@lists.xml.org
Subject: [xml-dev] Serialising XML Schema to HTML form and getting it back as XML instance
Hi all.
We have a XML schema that we would like to use to:1. generate HTML form/XForm/ whatever works bests.2. User fills in the form fields in a browser, with as much validation possible client side (probably some JS library).3. The form is sent back to the server, ideally as XML instance straight away or converted server side so that it can be validated against the schema and stored.
What's the current state of the art in this?It's a greenfield project so we're free to use whatever we want, but it looks like XForms are still not natively supported in the browsers so I think not much has changes in recent years and we'll have to generate HTML Forms from the schema.It looks equally backwards when sending/POSTing the data - it looks like the data will be sent using the usual HTTP headers and then we have to worry how we convert it back into XML for validation, right?
Any thoughts on how to do it as automatically and pain free as possible, would be very welcome.
Lech