nexusformat / definitions

Definitions of the NeXus Standard File Structure and Contents
https://manual.nexusformat.org/
Other
26 stars 55 forks source link

consistent NeXus namespace in xml files #1374

Open woutdenolf opened 3 months ago

woutdenolf commented 3 months ago

The NeXus namespace prefix in nxdl.xsd is nx

<xs:schema 
        ...
    xmlns:nx="http://definition.nexusformat.org/nxdl/3.1">

while in nxdlTypes.xsd it is nxdl

# nxdlTypes.xsd
<xs:schema 
        ...
    xmlns:nxdl="http://definition.nexusformat.org/nxdl/3.1">

This is not necessarily a problem from the XML point-of-view but in our dev_tools we parse these files like this

https://github.com/nexusformat/definitions/blob/4c09c7718c41dc90eb996475efdf1c0d30fb1d5d/dev_tools/docs/xsd_units.py#L45

https://github.com/nexusformat/definitions/blob/4c09c7718c41dc90eb996475efdf1c0d30fb1d5d/dev_tools/docs/nxdl.py#L148

so you need to be careful and know what perfix was used in what file.

Proposal

Use the same NeXus namespace prefix everywhere (either nx or nxdl).

File that are affected

All .xsd and .xsl files

./nxdl.xsd
./nxdlTypes.xsd
./utils/nxdlxref.xsl
./applications/nxdlformat.xsl
./contributed_definitions/nxdlformat.xsl
./base_classes/nxdlformat.xsl

Any python file that parses them.

None of the .nxdl.xml files are affected because the NXDL namespace is the default namespace.

<definition
    xmlns="http://definition.nexusformat.org/nxdl/3.1"  # no prefix needed to use elements from the NeXus namespace
    ...
    >

This means there is no need to use a namespace prefix using definition elements from the NXDL schema. So none of the NeXus definitions as affected by this