Interface Generation from Nuxeo XSD Files

2

August 19, 2012 by huionn

Nuxeo platform such as document schema is very flexible. However, like loose typing language, the flexibility has a drawback. The compiler cannot detect the typos in properties names. Changing the a xsd file without changing all related Java classes will cause unforeseeable runtime exception. In addition, for client-server application like my legal case management system, this is more error-prone as the client application is in another project. My client application uses JAX-RS with JSON and CMIS to communicate with server.

Because of this drawback, I decide to generate a interface for each xsd file that can be shared by client and server (as jar). Unfortunately, I am unable to find any existing tool in Nuxeo that can do generate interfaces from xsd files.

So, I tried other project that can generate Java class from xml schema (xsd), such as JAXB and XMLBean. Both generate Java class for binding, but the generated classes are too complicated for my use case.

Finally I decide to code my own naive XSD parser with XSOM. It is definitely not robust and requires tweaking from time to time. But at the moment, it serves my requirement well.

Advertisements

2 thoughts on “Interface Generation from Nuxeo XSD Files

  1. Hi,
    What about Nuxeo Studio? It’s really handy if you want to avoid typos while designing your document typology.

    • huionn says:

      Nuxeo Studio is very nice, but I cannot afford it for my small personal project : )

      To prevent typos, I also generate property names (of schema) as constants in the interface.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: