Re: How to mix switches and crossings en connections ? [message #1365 is a reply to message #1364] |
Fri, 17 June 2016 10:40 |
christian.rahmig
Messages: 436 Registered: January 2016
|
Senior Member |
|
|
Dear Patrick,
Am 17.06.2016 um 10:04 schrieb Patrick Renaud:
> [...]
>
> These three definitions are coherent and indicate that a
> <xs:choice> element cannot contains both the sub-elements it
> defines.
>
> In other words, in the RailML, a <connections> element
> cannot contains both <switch> AND <crossing> elements.
>
> Your code snippet is not valid with the validation tool
> xmllint which is based on the library LibXML 2.7.7
Your first sentence is correct. A <xs:choice> element can only contain
one sub element. However, you forgot the <xs:choice> element's optional
parameters minOccurs and maxOccurs. In [1] you can read their definition:
* minOccurs: Optional. Specifies the minimum number of times the
choice element can occur in the parent element. The value can be any
number >= 0. Default value is 1
* maxOccurs: Optional. Specifies the maximum number of times the
choice element can occur in the parent element. The value can be any
number >= 0, or if you want to set no limit on the maximum number, use
the value "unbounded". Default value is 1
In the case of the railML switch/crossing modelling, we used these
parameters to define that the <xs:choice> element may occur 0 to
unbounded times:
<xs:choice minOccurs="0" maxOccurs="unbounded">
Therefore, a <connections> element may contain an arbitrary number of
<switch> and <crossing> elements. All tools and their included XML
validators that we are working with (XMLSpy, oXygen, eclipse) confirm
that approach.
Did anybody else of the forum readers experience similar problems like
this? Any feedback appreciated...
[1] http://www.w3schools.com/xml/el_choice.asp
Best regards
--
Christian Rahmig
railML.infrastructure coordinator
Christian Rahmig – Infrastructure scheme coordinator
railML.org (Registry of Associations: VR 5750)
Altplauen 19h; 01187 Dresden; Germany www.railML.org
|
|
|