Open domna opened 4 months ago
Show us the XML Schema code (for the nxdl.xsd
file) that implements the choice
element. The NXcansas definition has such a situation, involving the definition of the slit length.
I'm not really experienced in writing xsd but I tried to draft something:
<xs:element name="choice">
<xs:complexType>
<xs:choice>
<xs:sequence>
<xs:element name="group" type="nx:groupType" minOccurs="2" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="field" type="nx:fieldType" minOccurs="2" maxOccurs="unbounded"/>
</xs:sequence>
</xs:choice>
</xs:complexType>
</xs:element>
as far as I understood it is not really possible to disallow the use of the name
attribute. There might be the possibility to use assert for XSD1.1, but I'm not sure whether this version works with the current nxdl.xsd
so I left it out.
NXDL supports a choice for groups (https://manual.nexusformat.org/defs_intro.html#choice). I think it would be useful to also allow the choice to select between multiple fields. It could then be an unnamed choice tag.
Here is an example of my idea:
It could then also be properly distinguished: a choice tag without a name could only contain fields and a choice tag with a name could only contain groups.