Aishwarya
Aishwarya

Reputation: 49

XSD to HTML form

What I want to do:

I'm basically trying to create a tool which generates a HTML form where the data can be entered, which gets stored in the corresponding XML file. The HTML form in itself needs to be created with the help of the given XSD.

Problems I faced:

  1. I converted the XSD file into JavaObjects by executing a DOS Command (xjc.exe filename.xsd ). The created Java files don't have the restrictions.

  2. If the restrictions aren't available then the form will take in random values.

  3. Can't figure out a way to convert the XML file into an HTML form .

If there is any other way out for this problem , I'm all ears. I'm new to XML and XSD so having a hard time figuring it out. Thanks in advance for the help

Upvotes: 2

Views: 1564

Answers (1)

kjhughes
kjhughes

Reputation: 111621

I'm basically trying to create a tool which generates a HTML form where the data can be entered, which gets stored in the corresponding XML file. The HTML form in itself needs to be created with the help of the given XSD.

You are describing XForms, which never achieved widespread support, but which should be understood before endeavoring to build solutions in this area. There have been many implementations, but see in particular XSLTForms, which is based on XSLT, JavaScript, and HTML and is open source. Use or at least study it.

I converted the XSD file into JavaObjects

There's no real need to introduce Java. You need HTML and JavaScript, minimally, and XSLT is the ultimate in transforming XML. Java offers little advantage to your endeavor, other than possibly hosting the XSLT transformation if you wish that they be performed server-side.

Upvotes: 1

Related Questions