Public URL for Schema and Define XML Namespace
Describe the feature
- It would be nice to have a static URL for XML Schema files
- It is considered best practice to define a XML namespace
Currently, the opening tag of a typical OpenSCENARIO 1.x .xosc-file looks like this:
<OpenSCENARIO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="OpenSCENARIO.xsd">
Issue 1.
All major XML-editing programs use the .xsd schema file to drastically enhance the user experience by validating the XML structure and by providing autocompletion.
To find the corresponding schema in this case, the program reads the xsi:noNamespaceSchemaLocation
attribute which can contain an absolute path, a relative path or a web-URL.
Neither absolute nor relative paths are practical when working with .xosc files, especially when sharing scenarios across multiple developers or even companies whose project-directory structure might be vastly different.
Issue 2.
Instead of using a path to an XML schema that is defined in the document itself, XML editors typically can also be configured to have a mapping from a XML schema to a local schema file. Defining a namespace for XML schemas is considered a good practice [1][2]. The Problem is that there is no namespace defined for OpenSCENARIO files.
Describe the solution you would like
Issue 1.
- Make the OpenSCENARIO.xsd file publicly available at an URL, taking a versioning scheme into account, e.g.
https://schemas.asam.net/OpenSCENARIO/1.1/OpenSCENARIO.xsd
- Chose this URL carefully so that it will never change in the future
- Update the example files and encourage the use of this schema location in the documentation
<OpenSCENARIO
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schemas.asam.net/OpenSCENARIO/1.1/OpenSCENARIO.xsd">
Issue 2.
- Define an XML namespace for OpenSCENARIO files. In theory, this can be any string, but by convention, it as also shaped like a HTTP-URL. E.g.
https://schemas.asam.net/OpenSCENARIO/1.1/
- Having a HTML page at this URL is not required but makes sense
- Update the schema file
targetNamespace
and example files
Example without schema location
<OpenSCENARIO
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://schemas.asam.net/OpenSCENARIO/1.1/">
Example with schema location
<OpenSCENARIO
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://schemas.asam.net/OpenSCENARIO/1.1/"
xsi:schemaLocation="https://schemas.asam.net/OpenSCENARIO/1.1/ https://schemas.asam.net/OpenSCENARIO/1.1/OpenSCENARIO.xsd">
Describe alternatives you have considered
These two features can be implemented independently of each other. Each one individually would solve the initially mentioned problem, however implementing both fixes together would be ideal.
Describe the backwards compatibility
Issue 1 does not affect backwards compatibility. But it should be ensured that the URL does not change later to ensure forwards compatibility.
Issue 2 might affect validation when mixing old schemas with new files and vice-versa (which already might lead to validation errors in the first place)