[Nexus] Fwd: Re: [NeXus-tech] XML and new attribute

Pete Jemian prjemian at gmail.com
Fri Feb 13 13:53:48 GMT 2015



On 2/13/2015 3:08 AM, Eugen Wintersberger wrote:
> So I should have asked more precisely what would be close to NXDL -
> storing the attributes as parts of the tags or as children of the field
> tag.

children of the field tag


On 2/13/2015 3:08 AM, Eugen Wintersberger wrote:
 > If I sum this up: mandatory attributes go into the field tag itself
 > (like type, name, units, long_name, etc.) and are thus part of the NXDL
 > language. Optional attributes are stored as children of the field tag
 > and hence cannot be part of the NXDL language.

No.  All the attributes you describe will be declared using the 
"attribute" element in an NXDL file.  This is true even for any 
locally-defined files you might use to write specific data files.

In the NXDL specification file, the only attributes allowed to the field 
tag are those described in the nxdl.xsd file.  Attributes destined for 
the HDF5 file (like type, name, units, long_name, etc.) with fixed 
values must be specified with the "enumeration" element, which is a 
child of the field element to which they apply.

Here's an example to get this structure:

    phi: NX_FLOAT
      @depends = chi
      @transformation = rotation
      @vector:NX_FLOAT = [0 1 0]
      @offset:NX_FLOAT = [0 0 0]

Here is the NXDL declaration to get that structure:

<field name="phi" type="NX_FLOAT">
   <attribute name="depends">
     <enumeration>
       <item value="chi" />
     </enumeration>
   </attribute>
   <attribute name="transformation ">
     <enumeration>
       <item value="rotation" />
     </enumeration>
   </attribute>
   <attribute name="vector" type="NX_FLOAT">
     <enumeration>
       <item value="[0 1 0]" />  <!-- may be a problem for nxdl.xsd -->
     </enumeration>
   </attribute>
   <attribute name="offset" type="NX_FLOAT">
     <enumeration>
       <item value="[0 0 0]" />  <!-- may be a problem for nxdl.xsd -->
     </enumeration>
   </attribute>
</field>

The two different kinds of problems with this are:

* "offset" is used incorrectly as noted in other discussion thread 
(needs a new name for this use)

* In XML, must express the value of an attribute (such as value=) in 
double quotes.  Can we accept this syntax to indicate an array 
attribute?  Otherwise, we could change the way that "item" element 
values are declared in NXDL files.  This change would affect many NXDL 
files and also the documentation publishing tools.  A very simple change 
to make.  Result would look like:


       <item/>
         <doc>documentation for "item" elements is already allowed</doc>
         <value>[0 0 0]</value>
       </item>


Does these definitions help to reduce confusion?

:nxdl.xsd:
     XML Schema that defines the rules for writing NXDL files.

:NXDL files (*.nxdl.xml):
     NXDL files declare the rules for storing data in HDF files

Pete



More information about the NeXus mailing list