Right now I'm trying to write some Java code that parses an XML schema and produces XForms. (Chiba has a tool called Schema2XForms Builder, but it doesn't implement all of the xsd elements that my company's application requires). I have a solution to implementing xsd:choice, but it's memory requirements can explode exponentially when choices are nested.
The solution I'm currently implementing involves an instance structure that is basically as follows:
The choices are inside the <CHOICE> tag, and then I used a binding element to indicate which choice is relevant. In turn, only the controls pertaining the that choice are displayed on the form. The index number inside of the <CHOICE_RELEVANT> tag is changed by binding it to an XForms select1 control - each choice is labeled by the element name of the choice. Later I will flatten the instance data by removing the the CHOICE and CHOICE_RELEVANT tags (as well as other tags that I use for similar purposes) to wind up with something like the following:
Is there a better way to do this, or am I stuck with exponential space requirements?
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.