[Redmine #8191] Use XSD features for stricter check of OSC elements
Bugzilla Link | 4041 |
Created on | May 23, 2019 13:29 |
Version | 0.9.1 |
Extended Description
https://redmine.vires.com/issues/8191
René Weidling wrote:
In the Arbeitskreis on 08.08.18 we discussed several points on how the XSD defining the OSC format could be altered in order to make it more fool-proof and check for certain dependencies already on XML-Level. This can be used to enforce unique naming of elements or check for logical dependencies, like assuring a Driver-Controller is only used for a Vehicle-Object or limiting the number of times the SetEnvironment GlobalAction is called in the Storyboard-Init Phase to 1.
While we haven't finished any examples yet, this hopefully serves as a starting point for a discussion on the usefulness of these aspects.
One important aspect for this are XSD-assertions, which can be used as of XSD 1.1 (Is this a problem in any way for OSC?).
https://www.oio.de/public/xml/w3c-xml-schema-1-1-ueberblick.htm
http://www.datypic.com/books/defxmlschema/chapter14.html
https://www.ibm.com/developerworks/library/x-xml11pt2/index.html
This could be used for the above-mentioned restrictions of the number of times a certain action is allowed to be called or to ensure mathematical relations are enforced, like relations between the vector componentss in the bounding boxes. It can also be used to enforce only Vehicle-Driver, Pedestrian-PedestrianController and MiscObject-None relations.
Here is an example on how to enforce unique names for elements:
https://stackoverflow.com/questions/5541305/xml-xsd-schema-enforce-unique-attribute-values-in-schema
https://www.data2type.de/xml-xslt-xslfo/xml-schema/element-referenz/xs-unique/
Using xsd:unique and a "reference" attribute, it is possible to ensure that for example object or story names are never ambiguous.