The NeXML XSD zone: an experimental generative XML Schema for NeXus
2008-10-30: The Eclipse XSD Java API has been used to automatically translate the NeXus Meta-DTDs (XML templates) into an XML schema (called NeXML). The Eclipse Modeling Framework (EMF) has been used to create EObject Java bindings and an EMF model editor for the NeXML schema. The system was presented at the meeting of the NeXus International Advisory Committee (NIAC), Oct 2008 in Sydney.
2008-10-30: A comprehensive webel.com.au technical report on NeXML for XSD is available online:NeXML: automating generation of an XML schema and EMF Java bindings from the XML templates
of the NeXus neutron, x-ray, and muon science data format, Kelly D. R. C., 2008. PDF
The NeXML conversion process starts by reading NeXus XML Template Meta-DTDs from file or streamed from the NeXus template SVN repository. A prototype Java NeXML tool parses the XML templates using org.dom4j, interprets the digested templates according to the NeXus Meta-DTD grammar, and then an XML Schema is written using org.eclipse.xsd. The templates are interpreted as group classes with data items or group-typed child elements, and written as XSD complex types to the NeXML schema.
The same process could be easily adapted to intepret the new
NeXus Definition Language (NXDL) XML templates (ratified at NIAC2008) !
Transformation of Groups
A typical NeXus "MetaDTD" XML-template (pre-NIAC2008) for a geometrical group:
Generated XSD complex types for NeXus groups extend a NeXML base hierarchy:
Transformation of group children
Child elements typed by a NeXus group become XSD elements of the matching type:
|The child elements of the NXinstrumentType in the Netbeans IDE XML schema view; most of the children are typed by groups.|
The NeXML NXentryType as a stereotyped, reverse-engineered UML class
with child "elements" as UML properties typed by group types.
Transformation of data item children
Some NeXus MetaDTD dataitems with complicated dimensions, units, and types:
|Encapsulation of implied NeXus enumeration for values of a specific data item. Netbeans IDE schema view.|
|Extract from NeXML schema: an array data item with explicit dimensions, finite array type, and units.|