NeXML: automating generation of an XML schema and EMF Java bindings from the XML templates

Authors: 
Kelly, D. R. C.
Year: 
2008
Publication type: 
Technical report
Notes: 

The system was presented at the meeting of the NeXus International Advisory Committee (NIAC), Oct 2008 in Sydney.

It is demonstrated that the XML base class templates (a.k.a. “meta-DTDs”) of the NeXus neutron and x-ray science data format can - with the aid of the Java XSD API of the Eclipse Foundation XSD project - be transformed into an XML Schema, thus introducing convenient validation of NeXus XML instance files, with bindings to Java EObjects through the XML schema import mechanism of the Eclipse Modelling Framework (EMF), which also provides a generative, validating, schema-aware XML model instance editor.

The approach is limited by known inconsistencies in the current NeXus templates and by some aspects of the NeXus class design. The transformation process affords powerful diagnosis of and identification of inconsistencies in the NeXus XML templates. Recommendations are made here for changes to the NeXus template design and format to support this generative approach, so that the NeXus International Advisory Committee (NIAC) could in principle continue to maintain adapted forms of the NeXus XML templates, rather than moving the base class definition effort completely to the XML Schema approach, given that the XML Schema could then be generated after the method shown here. The NeXML approach optionally leverages the prototype NeXus.xsd base schema, and some recommendations are also made here for changes to that base schema to admit more robust automated generation of NeXus XML Schema classes, and stronger validation criteria.

It is shown that instruments and experiments can be represented graphically in the Unified Modelling Language (UML) as UML StructuredClassifiers and as UML InstanceSpecifications, using reverse engineered XML Schema types as UML Classes with structural UML Properties, UML Stereotypes and XML Schema annotations.