MBZ
MBZ

Reputation: 27582

generate web form from XSD

I wanna create a web form based on an XSD and view/save/load the user inputs in XML format (something like an xml editor). Is there any fast way to do this?

my XSD might contains some problems and is very huge. I don't care if the form will become huge as well!

Upvotes: 7

Views: 23325

Answers (6)

Michiel Meulendijk
Michiel Meulendijk

Reputation: 355

I know this is an old question, but I ran into this issue myself and couldn't find a satisfying open-source solution. I ended up writing my own implementation, XSD2HTML2XML. To my knowledge it is the most complete tool out there. It supports a lot of what the topic starter asked for (and a lot more :)):

  • automatic generation of HTML form from XSD
  • includes elements, attributes, groups, extensions, and restrictions
  • allows loading data from an XML document into the generated form

If you prefer an out-of-the-box solution rather than writing your own, please see my implementation, XML Schema Form Generator.

Upvotes: 2

Alexis Panagiotopoulos
Alexis Panagiotopoulos

Reputation: 432

The path I propose is to translate your xsd to json schema and then generate forms from your new json schema. At the end translate the generated json object back to xml.

xsd -> json schema

https://github.com/highsource/jsonix-schema-compiler
Tool based on jsonix that can generate json schema from xsd and covers most xsd cases.

json chema -> html form

http://alpacajs.org/
Excellent and simple to use tool that can take any json schema and create an html form. You can even add your own customization on how the form will look and behave.

json -> xml

https://github.com/highsource/jsonix
I mentioned it above as well. It can easily translate your json to xml.

Upvotes: 2

Dave Moten
Dave Moten

Reputation: 12087

Self plug: xsd-forms is released and works well for a limited subset of xsd types with no server side couplings.

Upvotes: 2

Thinker
Thinker

Reputation: 39

XSDForm can solve your problem. It can convert your XML Schema to a web form on your website (XSD to Web Form).

Upvotes: 3

Simon
Simon

Reputation: 3285

I am working on my own project called XsdFormEditor. Application will be able to show any XSD as a form in WinForms (95% done), Web (using Asp.Net MVC, 0% done), WPF (0% done). Idea is to load any XSD file, show it to user as a form, let user input some data and save data as XML. User will be also able to load default values to form from XML file. You can find it here: https://github.com/janstafa/XsdFormEditor

Upvotes: 0

Petru Gardea
Petru Gardea

Reputation: 21638

This is one thread on SO that is the same as your question; since then, someone added an answer about a new product I have not explored...

Another thread on Microsoft forums deals with the same; the alternate approach there was to map content through a database, since software that deals with web forms and databases seems to be more easily available.

If I would have to sum it up, the short answer is "not really" or "not straight forward, for sure". It would also help to understand what technology you intend to use: PHP, .NET, Java-based?

Upvotes: 2

Related Questions