averbraeck / opentrafficsim

Open Source Multi-Level Traffic Simulator
BSD 3-Clause "New" or "Revised" License
28 stars 8 forks source link

Bindings contains old references #105

Closed WJSchakel closed 5 months ago

WJSchakel commented 5 months ago

bindings.xml contains the following:

    <jaxb:bindings
      node="//xsd:element[@name='MandatoryIncentives']/xsd:complexType/xsd:choice/xsd:element[@name='Route']">
      <simplify:as-element-property />
    </jaxb:bindings>
    <jaxb:bindings
      node="//xsd:element[@name='VoluntaryIncentives']/xsd:complexType/xsd:choice/xsd:element[@name='Keep']">
      <simplify:as-element-property />
    </jaxb:bindings>
    <jaxb:bindings
      node="//xsd:element[@name='AccelerationIncentives']/xsd:complexType/xsd:choice/xsd:element[@name='TrafficLights']">
      <simplify:as-element-property />
    </jaxb:bindings>
    <jaxb:bindings node="//xsd:element[@name='Categories']/xsd:complexType/xsd:choice/xsd:element[@name='Ego']">
      <simplify:as-element-property />
    </jaxb:bindings>
    <jaxb:bindings
      node="//xsd:element[@name='BehavioralAdaptations']/xsd:complexType/xsd:choice/xsd:element[@name='SituationalAwareness']">
      <simplify:as-element-property />
    </jaxb:bindings>

These were put in place to make the individual elements better accessible even though they are placed inside an xsd:choice. Note that the path needs to point to only a specific element, hence the [@name='Route'] etc. Every such element results in a list, although only one may be specified within the choice. The choice was used to allow any order in which elements are specified in xml.

For the first three, the xsd:choice was changed to an xsd:all, which inherently allows any order. It also allows up to 1 of each child element. Therefore, the Class child elements were removed. This is a very unfriendly way to specify model elements anyway. Moreover, the workflow with xsd/xml and editor we now have, makes it very easy to specify new child elements that will be parsed to instances of new classes for particular model elements.

Because the xsd:choice was changed to xsd:all, the paths cannot be found and the code cannot be compiled.

WJSchakel commented 5 months ago

The bindings have been removed, and the parsing code was changed to check for null, rather than for an empty List.

For the latter two, the xsd:choice is now also changed to xsd:all, the bindings are removed, and the parsing code was similarly updated.