[NeXus-tech] continuing progress on nxdl2xsd.xsl

Akeroyd, FA (Freddie) freddie.akeroyd at stfc.ac.uk
Wed Dec 17 12:33:54 GMT 2008


> 
> for example, these two NXDL lines:
>    <group name="other_notes" type="NXnote"/>
>    <group type="NXcharacterization" />
> will translate to these XML Schema lines
>      <xs:element name="other_notes" minOccurs="0"
maxOccurs="unbounded"
> type="nx:NXnote"/>
>      <xs:element name="NXcharacterization" minOccurs="0"
> maxOccurs="unbounded" type="nx:NXcharacterization"/>
> 
> This type of rule is needed to avoid having duplicate name errors
> (Unique Particle Attribution violations) in the XML Schema files.
> Problems that cropped up were multiple NXlog entries with the same
name
> in NXsample or multiple NXnote entries in NXentry and NXdetector and
> perhaps other similar instances.  (This also looks like the intent of
> the name attribute in the NXDL group declaration and the metaDTD.)
> 

Pete, 

Though a "name" has been given for the NXnote, the NeXus XML instance
document will still have the same form as in the second case i.e.

<NXnote name="other_notes">

Thus the schema 

<xs:element name="other_notes" minOccurs="0" maxOccurs="unbounded"
type="nx:NXnote"/>

Will not validate a NeXus XML file directly. Was the idea to transform
all references to <NXnote name="other_notes"> in an instance document
into <other_notes> prior to schema validation? That would work so long
as only NX groups that had "name" specified in the schema were
transformed so this operation would need to be schema aware.

Unfortunately "Unique Particle Attribution violations" and being unable
to assign more than one type to an "NXnote" instance element restricts
what we can do i.e. we cannot derive a new type from NXnote that has the
"name" attribute fixed as "other_note" and write

<xs:element name="NXnote" minOccurs="0" maxOccurs="unbounded"
type="nx:NXnote">
<xs:element name="NXnote" minOccurs="0" maxOccurs="1"
type="nx:NXnote_with_name_attribute_fixed_to_other_notes">
   
It might be we can do something with regular expressions to avoid
"Unique Particle Attribution violations" but I think we may still get
stuck on being unable to have two elements with the same name and
different types.

Regards,

Freddie
-- 
Scanned by iCritical.



More information about the NeXus-tech mailing list