1

I have a requirement where i need to generate html forms on the fly based on many different xml schema's (as of now i have 20 of them and the count keeps increasing). I need to collect data from the user to create instance docs corresponding to each of them and then store the instance docs in db....

challenges 1) schema has lot of unbounded complex types. so we doesnt know in advance the number and type of input types to be created. so pre-creating html etc is not an option 2) even if i can handle generation of the form on the fly, the problem is collecting the data entered..as forms generated dynamically should/will have dynamic id/names for input types

Can anyone suggest the best way to implement this?

thank you in advance

4 Answers 4

1

It seems to me like a clear case for XSLT.

Generating HTML from XML through XSLT is the primary goal of XSLT.

As for the id/names, you can create an XSLT which will also generate a set of id/names in a way that you can use.

Sign up to request clarification or add additional context in comments.

2 Comments

Damn, beat me to it. ;) +1 for XSLT, it's definitely the way to go here.
Then improve on my answer with one of your own. I'm not feeling like writing examples and such, but if he doesn't know XSLT, he might well need a few.
1

Use WSDL2XForms to create XForms from XML Schemas (XSD). Then publish them with Chiba (chiba.sourceforge.net) - it converts these XForms to standard HTML forms on the server side.

2 Comments

thx a bunch for the pointer...but there is no files to downlaod...am i missing something
I understand that you're using XForms as an intermediary, but it still worries me using a dead technology.
1

The Google Code project xsd-forms seems to be a promising approach.

A XQuery-based translator from XSD to XForms is available at http://en.wikibooks.org/wiki/XRX/XForms_Generator.

I don't know much about that one: http://nunojob.wordpress.com/2008/01/05/creating-a-user-interface-for-xml-schema-using-xforms/. Seems to be a presentation only.

Comments

0

We had a problem somewhat like this. One of our team thought that we ought to be able to create a web form UI on the fly to accept data conforming to an XSD. It turned out that this is very difficult ... given all the complexity of full XSD. So we ended up inventing our own schema language (which was both simpler and richer than XSD) and using this as the basis for generating our UI layouts. We also implemented a tool-chain for creating and validating the schemas and for generating equivalent XSDs and OWL schemas.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.