| [railML2+3] Problems with 24:00:00 for midnight at end of day [message #3536] |
Tue, 01 April 2025 20:58  |
Thomas Nygreen
Messages: 137 Registered: March 2008
|
Senior Member |
|
|
Dear all!
It has come to our attention that the default System.Xml library in MS .NET does not handle the time value/component "24:00:00" for midnight at the end of the day. This is a legal value for xs:time and legal part of xs:dateTime values according to the XML definition. For xs:time "24:00:00" is identical to "00:00:00", and for xs:dateTime "24:00:00" of one day is identical to "00:00:00" of the next day.
Except for IS:uptime, the use of "00:00:00" or "24:00:00" is not mentioned in the railML documentation or wiki. We have since 2021 recommended to use "24:00:00" for the @until attribute of IS:uptime, when referring to midnight at the end of the day. As a commonly used library is unable to parse the value "24:00:00" we will no longer recommend using it for IS:uptime, but this issue also extends to all railML attributes of type xs:time and xs:dateTime.
I am writing here in the timetable forum because xs:time is most heavily used in the timetable subschema, and any input from the timetable community is valuable in determining the way forward.
So the questions to the community are:
1. Are you using "24:00:00" in your interfaces?
2. Should we syntactically disallow the use of "24:00:00" from railML 3.4 onwards?
Best regards,
Thomas Nygreen
Thomas Nygreen – Common Schema Coordinator
railML.org (Registry of Associations: VR 5750)
Altplauen 19h; 01187 Dresden; Germany www.railML.org
[Updated on: Thu, 10 April 2025 17:08] Report message to a moderator
|
|
|
|
| Re: [railML2+3] Problems with 24:00:00 for midnight at end of day [message #3558 is a reply to message #3536] |
Thu, 10 April 2025 17:12   |
Thomas Nygreen
Messages: 137 Registered: March 2008
|
Senior Member |
|
|
Hello again,
I have tested and verified that "24:00:00" can be excluded from xs:time and xs:dateTime with restriction patterns:
<xs:simpleType name="tTimeUniqueMidnight">
<xs:restriction base="xs:time">
<xs:pattern value="([0-1][0-9]|2[0-3]).*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="tDateTimeUniqueMidnight">
<xs:restriction base="xs:dateTime">
<xs:pattern value="[0-9-]{10}T([0-1][0-9]|2[0-3]).*"/>
</xs:restriction>
</xs:simpleType>
It remains to be decided if we want to do this, so any feedback is very welcome.
Git issue: https://development.railml.org/railml/version3/-/issues/646
Best regards
Thomas
Thomas Nygreen – Common Schema Coordinator
railML.org (Registry of Associations: VR 5750)
Altplauen 19h; 01187 Dresden; Germany www.railML.org
|
|
|
|
|
|
| Re: [railML2+3] Problems with 24:00:00 for midnight at end of day [message #3630 is a reply to message #3559] |
Wed, 21 May 2025 16:22   |
Thomas Nygreen
Messages: 137 Registered: March 2008
|
Senior Member |
|
|
Dear David,
As mentioned in my first post, we changed the recommended best practice IS:uptime in railML2 after discussion in the group of coordinators. The new recommendation follows your third bullet point, while still allowing "24:00:00" with a warning:
"As from and until are mandatory, a mode for the whole day must be specified from="00:00:00" until="00:00:00" or from="00:00:00" until="24:00:00". In any case a midnight value in from shall be interpreted as midnight at the beginning of the day and a midnight value in until shall be interpreted as midnight at the end of the day. Although allowed in the XML standard, the value "24:00:00" is not handled by all XML libraries, notably the System.Xml library of Microsoft .NET, and may produce an error. Its use is therefore no longer recommended." [1][2]
Should we also reconsider this change of best practice? I do think the warning is needed, and I think a best practice should not require patching commonly used XML libraries (even if it is annoying that Microsoft defines its own reality).
The literal values "00:00:00" and "24:00:00" are only distinguishable if parsed as strings. According to the XML specification, they both simply mean midnight, and map to the same canonical value. This is the reason for interpreting any midnight value in the end attribute as midnight at the end of the day.
Best regards
Thomas
[1] https://wiki2.railml.org/wiki/IS:uptime
[2] https://development.railml.org/railml/version2/-/issues/487
Thomas Nygreen – Common Schema Coordinator
railML.org (Registry of Associations: VR 5750)
Altplauen 19h; 01187 Dresden; Germany www.railML.org
|
|
|
|
| Re: [railML2+3] Problems with 24:00:00 for midnight at end of day [message #4176 is a reply to message #3630] |
Mon, 07 September 2026 19:49  |
Thomas Nygreen
Messages: 137 Registered: March 2008
|
Senior Member |
|
|
Dear community!
In railML 3.4 beta 5 we have implemented the new types tTimeUniqueMidnight and tDateTimeUniqueMidnight that do not allow "24:00:00". As described earlier in this thread, there are two reasons for this:
1: For xs:time, there is no difference between "00:00:00" and "24:00:00". They both just mean midnight, and when read by a compliant library, they should both return the time 00:00:00. Allowing "24:00:00" can lead to expectations that there is a difference.
2: Not all commonly used XML libraries handle "24:00:00" at all, causing an error when parsing a file where such a value is present.
The implication is that any time interval that lasts until midnight will have end time given as "00:00:00". For xs:dateTime values, "24:00:00" was already equivalent to "00:00:00" of the next day. This change will mean that only the "00:00:00" version is allowed.
Please provide feedback if this change influences you!
Best regards,
Thomas
Thomas Nygreen – Common Schema Coordinator
railML.org (Registry of Associations: VR 5750)
Altplauen 19h; 01187 Dresden; Germany www.railML.org
|
|
|
|