问题
Currently I am struggling with two problems:
- I am receiving from outer server an XSD file and based on this file I have to generate XForm. Usually the XSD file is importing many other XSD files and so on.
- I am writing a GUI with XForm builder. When the user builds his custom XForm I need to generate from it an XSD file and send it back to the outer server.
Major question is: Is it possible to write those two converters which generate files and complies with the standard (XML Schema and XForms)? Do you know any existing library offering conversion between those two formats: XSD and XHTML?
It is important to mention that all constraints (not empty, numeric value, etc) need to be transformed as well.
I have only basic knowledge about XML technologies (XLS, XPath, XQuery...) so any suggestion will be helpful.
回答1:
Many people (including me) expects to get that XML Schema to XForms generator, but due to the complexities of XML Schema it has been hard to achieve until now.
Take a look at this three projects:
https://code.google.com/p/xrx/ Dan McCreary created XRX, an architecture for building XML based applications with examples, and one of the examples generates XForms from XSD Schemas using XQuery.
https://github.com/lcahlander Loren Cahlander has an interesting project called govworks that includes generation of XForms from XSD Schemas, also using XQuery, like XRX
http://sourceforge.net/projects/schema2xforms/ Steve Cameron has created a visual designer for Schemas that generates XForms, using XSLT
All these guys are very kind and for ure they will offer you help.
The bad news are that Importing external Schemas is not supported on none of these three projects right now. That's the most complex feature of XML Schema.
IBM built an XForms generator from Schemas as a plugin for eclipse, but it has been abandoned and no longer available for download :-(
来源:https://stackoverflow.com/questions/18616008/xsd-to-xforms-and-xforms-to-xsd-conversion