Skip to content

Commit

Permalink
Add examples and enable validation
Browse files Browse the repository at this point in the history
- Examples are OJP-1.0 files which have been adapted for 1.1-dev
- Use "./siri_model/siri_all-v2.0.xsd" for siri namespace everywhere as
  xmllint and Xerces-J only allow one <import> per target namespace
- Import ifopt namespace before siri, otherwise xmllint fails because
  the first found ifopt import statement in SIRI does not refer to
  "./ifopt/ifopt_allStopPlace-v0.3.xsd"
- Add "xml/xml.xsd" referenced by "./siri_utility/siri_types-v2.0.xsd"
  using https://www.w3.org/2005/08/xml.xsd
  • Loading branch information
sgrossberndt committed Nov 11, 2020
1 parent 836e8fb commit 767e054
Show file tree
Hide file tree
Showing 22 changed files with 8,636 additions and 44 deletions.
8 changes: 7 additions & 1 deletion .travis/xmllint-check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
/usr/bin/find . -type f \( -name "*.xsd" -or -name "*.xml" \) -print0 | while read -r -d $'\0' filename; do XMLLINT_INDENT=$'\t' xmllint --encode UTF-8 --pretty 1 "${filename}" > "${filename}.pretty"; mv "${filename}.pretty" "${filename}"; grep -i -v "xmlspy" "${filename}" > "${filename}.tmp" && mv "${filename}.tmp" "${filename}"; done;
echo "finished formatting"
# xmllint --noout --schema OJP.xsd examples/subdirectory1/*xml examples/subdirectory2/*xml

if xmllint --noout --schema OJP.xsd examples/*/*.xml; then
echo -e '\033[0;32mValidating examples succeeded\033[0m'
else
echo -e '\033[0;31mValidating examples failed\033[0m'
exit 1
fi
8 changes: 4 additions & 4 deletions OJP.xsd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ojp="http://www.vdv.de/ojp" xmlns:siri="http://www.siri.org.uk/siri" xmlns="http://www.siri.org.uk/siri" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" id="OJP_siri">
<!-- ===Dependencies ======================================= -->
<xs:schema xmlns="http://www.siri.org.uk/siri" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" id="OJP_siri">
<xs:import namespace="http://www.vdv.de/ojp" schemaLocation="OJP_Requests.xsd"/>
<!-- ======================================================================= -->
<xs:include schemaLocation="siri/siri_base-v2.0.xsd"/>
<!-- ifopt must be imported before siri, otherwise xmllint fails -->
<xs:import namespace="http://www.ifopt.org.uk/ifopt" schemaLocation="./ifopt/ifopt_allStopPlace-v0.3.xsd"/>
<xs:include schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<!--== SIRI Request include OJP Requests ===================================================================== -->
<xs:element name="OJP">
<xs:annotation>
Expand Down
6 changes: 2 additions & 4 deletions OJP_Common.xsd
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_reference-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_operator_support-v2.0.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_ModesSupport.xsd"/>
<xs:include schemaLocation="OJP_FacilitySupport.xsd"/>
<xs:include schemaLocation="OJP_Requests.xsd"/>
<xs:annotation>
<xs:documentation>========================================= General ================================================</xs:documentation>
</xs:annotation>
Expand Down
3 changes: 1 addition & 2 deletions OJP_FacilitySupport.xsd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_facilities-v1.2.xsd"/>
<!-- <xs:include schemaLocation="OJP_Common.xsd"/>-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:annotation>
<xs:documentation>==================================== Facilities from SIRI =============================================</xs:documentation>
</xs:annotation>
Expand Down
4 changes: 1 addition & 3 deletions OJP_Fare.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:include schemaLocation="OJP_FareSupport.xsd"/>
<xs:include schemaLocation="OJP_Trips.xsd"/>
Expand Down
5 changes: 1 addition & 4 deletions OJP_JourneySupport.xsd
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_utility/siri_location-v2.0.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:include schemaLocation="OJP_PlaceSupport.xsd"/>
<xs:include schemaLocation="OJP_FareSupport.xsd"/>
<xs:include schemaLocation="OJP_SituationSupport.xsd"/>
<!-- ===========================================================================================================-->
<xs:complexType name="ServiceViaPointStructure">
<xs:annotation>
<xs:documentation>[a specialisation of VIA in TMv6] STOP PLACE or SCHEDULED STOP POINT as a VIA for a particular SERVICE PATTERN. Specialisation of a VIA.</xs:documentation>
Expand Down
4 changes: 1 addition & 3 deletions OJP_ModesSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Utility.xsd"/>
<xs:annotation>
<xs:documentation>========================================= Individual Modes ============================</xs:documentation>
Expand Down
4 changes: 1 addition & 3 deletions OJP_PlaceSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:annotation>
<xs:documentation>========================================= Stop Points =============================================</xs:documentation>
Expand Down
4 changes: 1 addition & 3 deletions OJP_Places.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:include schemaLocation="OJP_PlaceSupport.xsd"/>
<xs:annotation>
Expand Down
3 changes: 1 addition & 2 deletions OJP_RequestSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri/siri_all_framework-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_journey_support-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:annotation>
<xs:documentation>====================================================Simple Types ====================================================</xs:documentation>
Expand Down
7 changes: 2 additions & 5 deletions OJP_Requests.xsd
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified" id="OJP_siri_service">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri/siri_requests-v2.0.xsd"/>
<!-- ===OJP Services ======================================= -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" xmlns="http://www.vdv.de/ojp" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified" id="OJP_siri_service">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Fare.xsd"/>
<xs:include schemaLocation="OJP_Places.xsd"/>
<xs:include schemaLocation="OJP_RequestSupport.xsd"/>
<xs:include schemaLocation="OJP_StopEvents.xsd"/>
<xs:include schemaLocation="OJP_TripInfo.xsd"/>
<xs:include schemaLocation="OJP_Trips.xsd"/>
<!-- ======================================================================= -->
<!-- ==== Fare Service=============================================== -->
<xs:element name="OJPFareRequest" type="OJPFareRequestStructure" substitutionGroup="siri:AbstractFunctionalServiceRequest"/>
<xs:complexType name="OJPFareRequestStructure">
Expand Down
2 changes: 1 addition & 1 deletion OJP_SituationSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all_situation-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:complexType name="SituationsStructure">
<xs:annotation>
<xs:documentation>Wrapper type for SIRI PtSituationsElementStructure</xs:documentation>
Expand Down
4 changes: 1 addition & 3 deletions OJP_StopEvents.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:include schemaLocation="OJP_JourneySupport.xsd"/>
<xs:group name="StopEventRequestGroup">
Expand Down
4 changes: 1 addition & 3 deletions OJP_Trips.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_utility/siri_location-v2.0.xsd"/>
<!-- ===========================================================================================================-->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:include schemaLocation="OJP_JourneySupport.xsd"/>
<xs:include schemaLocation="OJP_FareSupport.xsd"/>
Expand Down
4 changes: 1 addition & 3 deletions OJP_Utility.xsd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_utility/siri_location-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_utility/siri_types-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all-v2.0.xsd"/>
<xs:annotation>
<xs:documentation>========================================= General ================================================</xs:documentation>
</xs:annotation>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<OJP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.siri.org.uk/siri" xmlns:ojp="http://www.vdv.de/ojp" version="1.1-dev" xsi:schemaLocation="http://www.siri.org.uk/siri ../../OJP.xsd">
<OJPRequest>
<ServiceRequest>
<RequestTimestamp>2020-01-19T12:00:00Z</RequestTimestamp>
<RequestorRef>IRMA</RequestorRef>
<ojp:OJPPlaceInformationRequest>
<RequestTimestamp>2020-01-19T12:00:00Z</RequestTimestamp>
<MessageIdentifier>4711</MessageIdentifier>
<ojp:PlaceRef>
<StopPointRef>8530813</StopPointRef>
<ojp:Name>
<ojp:Text>Zürich Kreuzplatz</ojp:Text>
</ojp:Name>
</ojp:PlaceRef>
<ojp:Restrictions>
<ojp:Type>stop</ojp:Type>
<ojp:IncludePtModes>true</ojp:IncludePtModes>
</ojp:Restrictions>
</ojp:OJPPlaceInformationRequest>
</ServiceRequest>
</OJPRequest>
</OJP>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<siri:OJP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:siri="http://www.siri.org.uk/siri" xmlns:ojp="http://www.vdv.de/ojp" version="1.1-dev" xsi:schemaLocation="http://www.siri.org.uk/siri ../../OJP.xsd">
<siri:OJPResponse>
<siri:ServiceDelivery>
<siri:ResponseTimestamp>2020-10-01T17:54:38Z</siri:ResponseTimestamp>
<siri:ProducerRef>OJPCH_Prod</siri:ProducerRef>
<siri:Status>true</siri:Status>
<ojp:OJPPlaceInformationDelivery>
<siri:ResponseTimestamp>2020-10-01T17:54:38Z</siri:ResponseTimestamp>
<siri:RequestMessageRef>4711</siri:RequestMessageRef>
<siri:Status>true</siri:Status>
<ojp:CalcTime>20</ojp:CalcTime>
<ojp:PlaceResult>
<ojp:Place>
<ojp:StopPlace>
<ojp:StopPlaceRef>8530813</ojp:StopPlaceRef>
<ojp:StopPlaceName>
<ojp:Text>Zürich Kreuzplatz</ojp:Text>
</ojp:StopPlaceName>
<ojp:TopographicPlaceRef>23026261:27</ojp:TopographicPlaceRef>
</ojp:StopPlace>
<ojp:Name>
<ojp:Text xml:lang="de">Zürich</ojp:Text>
</ojp:Name>
<ojp:GeoPosition>
<siri:Longitude>8.55408</siri:Longitude>
<siri:Latitude>47.36488</siri:Latitude>
</ojp:GeoPosition>
</ojp:Place>
<ojp:Complete>true</ojp:Complete>
<ojp:Probability>1</ojp:Probability>
<ojp:Mode>
<ojp:PtMode>rail</ojp:PtMode>
<siri:RailSubmode>unknown</siri:RailSubmode>
</ojp:Mode>
<ojp:Mode>
<ojp:PtMode>tram</ojp:PtMode>
<siri:TramSubmode>cityTram</siri:TramSubmode>
</ojp:Mode>
<ojp:Mode>
<ojp:PtMode>bus</ojp:PtMode>
<siri:BusSubmode>localBusService</siri:BusSubmode>
</ojp:Mode>
</ojp:PlaceResult>
</ojp:OJPPlaceInformationDelivery>
</siri:ServiceDelivery>
</siri:OJPResponse>
</siri:OJP>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<OJP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.siri.org.uk/siri" xmlns:ojp="http://www.vdv.de/ojp" version="1.1-dev" xsi:schemaLocation="http://www.siri.org.uk/siri ../../OJP.xsd">
<OJPRequest>
<ServiceRequest>
<RequestTimestamp>2020-01-19T12:00:00Z</RequestTimestamp>
<RequestorRef>IRMA</RequestorRef>
<ojp:OJPPlaceInformationRequest>
<RequestTimestamp>2020-01-19T12:00:00Z</RequestTimestamp>
<MessageIdentifier>4712</MessageIdentifier>
<ojp:InitialInput>
<ojp:Name>Bern</ojp:Name>
</ojp:InitialInput>
<ojp:Restrictions>
<ojp:Type>stop</ojp:Type>
<ojp:IncludePtModes>true</ojp:IncludePtModes>
</ojp:Restrictions>
</ojp:OJPPlaceInformationRequest>
</ServiceRequest>
</OJPRequest>
</OJP>
Loading

0 comments on commit 767e054

Please sign in to comment.