Open woutdenolf opened 4 months ago
Feel like I should chime in since it touches NXdetector_channel, but dunno enough about namespaces to help :)
Feel like I should chime in since it touches NXdetector_channel, but dunno enough about namespaces to help :)
I'm not a specialist either, but this is what I understand: whenever you use an element from a schema (like NXDL or XSD) in an XML file, you need to specify which XML schema defines that element (i.e. which namespace). This is done by prefixing
<myprefix:parent_element xmlns:myprefix="http://some/url">
<myprefix:some_schema_element ...>
...
</myprefix:some_schema_element>
</myprefix:parent_element>
The word "myprefix" only matters in this file. You could use another word to refer to the same namepace in other files.
In case you use elements from more than one schema
<myprefix1:parent_element xmlns:myprefix1="http://some/url1" xmlns:myprefix2="http://some/url2">
<myprefix1:some_schema1_element ...>
...
</myprefix1:some_schema1_element>
<myprefix2:some_schema2_element ...>
...
</myprefix2:some_schema2_element>
</myprefix1:parent_element>
You can also specify a default namespace which allows you to omit prefixes
<parent_element xmlns="http://some/url">
<some_schema_element ...>
...
</some_schema_element>
</parent_element>
In all our .nxdl.xml
files we obviously use NXDL as the default namespace
<definition
xmlns="http://definition.nexusformat.org/nxdl/3.1"
>
<doc ...>
...
</doc>
<field ...>
...
</field>
</definition>
We could have done this but that would be unnecessary verbose
<nxdl:definition
xmlns:nxdl="http://definition.nexusformat.org/nxdl/3.1"
>
<nxdl:doc ...>
...
</nxdl:doc>
<nxdl:field ...>
...
</nxdl:field>
</nxdl:definition>
Now in NXdetector.nxdl.xml
and NXdetector_channel.nxdl.xml
we define
<definition
xmlns="http://definition.nexusformat.org/nxdl/3.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://definition.nexusformat.org/nxdl/@NXDL_RELEASE@"
>
</definition>
So we use NXDL as the default namespace as usual but then we define two other prefixes: xs
refers XSD (which is the schema used the define the NXDL schema itself) and ns
which refers to a particular NXDL version. Neither of these prefixes out used in NXdetector.nxdl.xml
and NXdetector_channel.nxdl.xml
. Moreover it adds confusion to people like me how are not very familiar with XML schema's. So I propose to remove them.
Closes #1371