Saturday, March 19, 2011

Generating a GUI to edit XML, starting from XSD

When you give your customer a XML-based interface, you better help him produce the XML, at least for testers to play with your service.... not everybody is comfortable with XMLSpy (besides, its licence is VERY expensive).

I have tried Excel as a XML editor, but it flattens a complex graph to a single row,
so every repetead dependent object occupies a new row and forces you to repeat the master object data (sucks).
Besides when you try to export XML it keeps saying:

Cannot save or export XML data. The XML maps in this workbook are not exportable

I have tried adding ID to help Excel track dependent objects:

at the end of your complex type, add:

xs:attribute name="id" type="xs:ID" use="required"

and the ancestor should have:

xs:attribute name="idref" type="xs:IDREF" use="required"

here some examples (really cool musing over Schema Design):
http://www.xfront.com/GlobalVersusLocal.html




here how to define an id

P1 is a good ID
1 is NOT a good ID

IDs must be unique in the document, otherwise you get a validation error

Still Excel gets confused and gives unhelpful error messages when exporting.

Looking for some better way to visually edit I found JAXFront

Here an excellent demo of JaxFront XUIeditor

here the FAQs; My first question was : does it generate Java code, And the answer is: no, it generates a XUI file which is then run my the JaxFront engine.


I have tested on my XSD and the result was quite satisfactory.

No comments: