enRoute Blog

Langue


Categories


Suivez-nous


How to validate a NeTEx file ?

Luc DonnetLuc Donnet

This post is also available in: frFrançais

What is a NeTEX file ?

NeTEx (Network Exchange) is a reference format for data exchange, collective transport, defined at European level. It provides a description of network topology, schedules, pricing datas and access to information services.

A NeTEx file is simply a unique or group of XML files, that must be compliant with a (complete) XSD schema.  

For French readers, you’ll find a lot of resources in this page.

You can read the European NeTEx profil which gives a good overview on what can contain a NeTEx file here.

Validate the NeTEx Schema in command-line

We benefit from the amazing work performed by the NeTEx CEN team. They maintain an uptodate and living XSD in their GitHub repository : https://github.com/NeTEx-CEN/NeTEx. They provide both an XSD of NeTEx format and a large set of examples.

Our internal tool uses their XSD to valid a given NeTEx file. This simple command line tool in Ruby will give you a direct feedback of your XML file :

$ bundle exec ruby netex-cli-validator.rb netex_full20190212.xml
1060:27: ERROR: Element '{http://www.netex.org.uk/netex}CompanyCode': This element is not expected. Expected is one of ( {http://www.netex.org.uk/netex}validityConditions, {http://www.netex.org.uk/netex}ValidBetween, {http://www.netex.org.uk/netex}alternativeTexts, {http://www.netex.org.uk/netex}keyList, {http://www.netex.org.uk/netex}Extensions, {http://www.netex.org.uk/netex}BrandingRef, {http://www.netex.org.uk/netex}PublicCode, {http://www.netex.org.uk/netex}PrivateCode, {http://www.netex.org.uk/netex}CompanyNumber, {http://www.netex.org.uk/netex}ExternalOperatorRef ).
1078:22: ERROR: Element '{http://www.netex.org.uk/netex}stopPlaces': This element is not expected. Expected is one of ( {http://www.netex.org.uk/netex}validityConditions, {http://www.netex.org.uk/netex}ValidBetween, {http://www.netex.org.uk/netex}alternativeTexts, {http://www.netex.org.uk/netex}keyList, {http://www.netex.org.uk/netex}Extensions, {http://www.netex.org.uk/netex}BrandingRef, {http://www.netex.org.uk/netex}Name, {http://www.netex.org.uk/netex}Description, {http://www.netex.org.uk/netex}TypeOfFrameRef, {http://www.netex.org.uk/netex}BaselineVersionFrameRef ).
38934:84: ERROR: Element '{http://www.netex.org.uk/netex}LineRef': This element is not expected. Expected is one of ( {http://www.netex.org.uk/netex}DirectionRef, {http://www.netex.org.uk/netex}pointsInSequence, {http://www.netex.org.uk/netex}InverseRouteRef ).
38998:28: ERROR: Element '{http://www.netex.org.uk/netex}stopAssignements': This element is not expected. Expected is one of ( {http://www.netex.org.uk/netex}serviceLinks, {http://www.netex.org.uk/netex}servicePatterns, {http://www.netex.org.uk/netex}stopAreas, {http://www.netex.org.uk/netex}connections, {http://www.netex.org.uk/netex}tariffZones, {http://www.netex.org.uk/netex}stopAssignments, {http://www.netex.org.uk/netex}timingPoints, {http://www.netex.org.uk/netex}timingLinks, {http://www.netex.org.uk/netex}timingPatterns, {http://www.netex.org.uk/netex}journeyPatterns ).

You need only a Ruby / Bundler environment. Check the install instructions in the netex-cli-validator repository : https://github.com/af83/netex-cli-validator.

Export NeTEx file inside Chouette

The incoming NeTEx “Full” export will provide to Chouette users a simple solution to export all their data in this format. Check our roadmap for more details about this powerful feature. A NeTEx full file example is available on our dev wiki.

 

Comments 0
There are currently no comments.