We are in the process of formalizing the definition of NeXus files using XML. The hierarchical structure of NeXus files maps very conveniently into XML files with NeXus groups and items as the XML entities, and data attributes as XML attributes. Eventually, we intend to provide utilities to read NeXus files, produce the equivalent XML file, and use standard validation tools to help people determine whether their files are standard-conforming. However, formal XML format definitions (DTDs) are difficult for the non-expert to read, so we have produced a much simpler meta-DTD format, which produces well-formed (DTD-less) XML files that will be converted into DTD files. This page describes the rules for producing these files - some examples are available below and in the NeXus content section. The utility NXtoDTD can be used to generate the skeleton of such a file from an existing NeXus file; it outputs the XML tags without the data or any annotation.
<?xml version="1.0" ?>
<!-- URL: http://www.neutron.anl.gov/nexus/xml/NXgroup.xml Editor: Jean Dupont <JDupont@some.where> $Id$ Definition of a fake but well-formed NeXus group. -->
N.B. XML attributes are the name="value" pairs located within the opening tag of the XML entity, e.g. <NXsample name="sample">.
<temperature type="NX_FLOAT32" units="K">
<NXdetector name="{Name of detector bank}">
<temperature>{Temperature of sample}</temperature>
* May occur 0 or more timese.g.
+ May occur one or more times (i.e. at least once)
? May occur 0 or one times (i.e. no more than once)
<NXsample>?If no symbol is given, the item is mandatory.
<temperature>{Temperature of sample}?</temperature>
</NXsample>
<polar_angle type="NX_FLOAT32[:]">Replace the colon with i, j, ... if you wish to match the dimension length to other data items within the same group.
<analysis version="$Revision$">
The instrument definitions are being constructed out of XML files for each of the component groups. If you are interested in defining your own definition, please form them from these component parts (remove the XML document type at the top of each file). See NXtofnpd.xml for a complete example. The following is a colorized version of NXmonitor.xml.
<?xml version="1.0" ?>
<!--
URL: http://www.neutron.anl.gov/nexus/xml/NXmonitor.xml
Editor: Ray Osborn <ROsborn@anl.gov>
$Id$
Definition of monitor data. It is similar to the NXdata groups containing
monitor data and its associated dimension scale, e.g. time_of_flight or
wavelength in pulsed neutron instruments. However, it may also include
integrals, or scalar monitor counts, which are often used in both in both pulsed
and steady-state instrumentation.
-->
<NXmonitor name="{Name of monitor}">
<distance units="m" type="NX_FLOAT32">
{Distance of monitor from sample}
</distance>
<integral type="NX_FLOAT32">
{Integral over monitor spectrum}?
</integral>
<range type="NX_FLOAT32[2]">
{Time-of-flight range over which the integral was calculated}?
</range>
<type>
"Fission Chamber"|"Scintillator"?
</type>
<height units="cm" type="NX_FLOAT32">
{Height of monitor}?
</height>
<width units="cm" type="NX_FLOAT32">
{Width of monitor}?
</width>
<time_of_flight units="microseconds" type="NX_FLOAT32[i]">
{Time-of-flight}?
</time_of_flight>
<efficiency type="NX_FLOAT32[i]">
{Monitor efficiency}?
</efficiency>
<data type="NX_INT32[i]">
{Monitor data}?
</data>
</NXmonitor>
[NeXus Glossary | NeXus Instruments | NeXus Site Map]
Comments to: Ray Osborn <ROsborn@anl.gov>
Revised: Saturday, September 14, 2002
Copyright © 1996-2002 NeXus Design Team. All rights reserved.