W3C home > Mailing lists > Public > www-forms@w3.org > August 2005

Re: Schema -> XForms

From: Swithun Crowe <swithun@swithun.servebeer.com>
Date: Thu, 18 Aug 2005 08:46:01 +0100 (BST)
To: Christopher Clark <cclark@genesecurity.net>
cc: www-forms@w3.org
Message-ID: <Pine.LNX.4.61.0508180816390.12907@meshach.swithun.servebeer.com>

I did something similar, generating HTML forms from a schema document, so
it can be done and it is useful.

I suppose you want to separate the generation into two parts - one part
(a) is for any schema and any XForm, the other part (b) is just for the
particular XForm you want to generate.

In (a), you have things like generating xf:select/xf:select1 from
xsd:enumeration, xf:repeat from @maxOccurs etc.

In (b) you have rules which say whether a particular element should have a
xf:input or xf:textarea control. There isn't anything in the schema which
dictates the control to choose in this sort of situation.

It might be a good time to use XSLT - you are transforming one XML
vocabulary to another. But then you would need to roll your own schema
parser, which would be a lot of work, unless you limited yourself
initially to a subset of all possible schema constructions.

An alternative would be to find an open source schema tool which compiles
schema (having done the parsing), and use this compiled form to generate
your XForms document in conjunction with an XSLT document for your
particular rules.

Hope these ideas are helpful.


On Wed, 17 Aug 2005, Christopher Clark wrote:

> I want to be able to take a schema and automatically
> generate forms that enable a web user to generate
> instances of the schema.
> I know that tools such as Microsoft InfoPath and
> XFormation have wizards that guide a developer through
> the process of creating a web form based on a Schema,
> but this is not enough for me - I want to take the
> Schema and in effect compile it into a form without
> any human guidance.
> My guess is that tools to help me in this way do not
> exist - my current approach, which seems to be
> working, is to use some recursive Java code to parse
> the schema using the JDOM library and to generate an
> XForms document.  XForms seems like the right
> language, since it uses XML as its native language and
> allows me to generate pages with dynamic behavior
> without having to generate scripting language.  But I
> want to make sure that I'm not reinventing the wheel
> here, and that there aren't existing tools that
> already do similar things.
> Thanks,
> Chris Clark
Received on Thursday, 18 August 2005 07:46:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:15 UTC