Samtrafiken NeTEx import

This page contains documentation with clarifications of how Netex (the Nordic Profile) data is imported by Samtrafiken.

The data is delivered in a zip file that consists of the following required files:

  • _shared_data.xml - A prefix is allowed in the file name as long as it matches “.*_shared _data.xml”.

  • _stops.xml - A prefix is allowed in the file name as long as it matches “.*_stops.xml”.

  • line_{Line.Number}_{Line.Id}.xml - One file per line. Files must contain “line” (case-insensitive) and end with “.xml”, but otherwise they may be named anything.

The files are described below.

Changelog of this documentation

2024-02-12 - Added the two fields JourneyPart.StartTimeDayOffset and JourneyPart.EndTimeDayOffset with explanations.

NeTEx version requirements

Samtrafiken requires submitted NeTEx datasets to comply with the Norwegian NeTEx 1.0.11 standard.

If you are using Java, you can use the netex-java-model package offered by Entur. This package helps validating your NeTEx files against the previously mentioned XSD files, and is the same validation as we use when we receive NeTEx files.

<dependency> <groupId>org.entur</groupId> <artifactId>netex-java-model</artifactId> <version>1.0.11</version> </dependency>

In order to validate a file, you can take a look at this example code:

NeTExValidator netexValidator = new NeTExValidator(); Schema schema = netexValidator.getSchema(); Validator validator = schema.newValidator(); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); validator.setErrorHandler(new XmlErrorHandler()); validator.validate(new StreamSource(netexFile));

If you want to validate the files in another way, you can use XSD files directly. These files can be found here:

In case the version requirements would change in a way that your Netex files no longer validate against the new version, Samtrafiken will contact you before the change happens.

Codespace, ids and versioning

  • The id attribute must follow the pattern: [codespace]:[type]:[id] or [countrycode]:[codespace]:[type]:[id] . Examples: 253:Authority:9010005000000000 or SE:253:Authority:9010005000000000.
    Be consistent with your choice throughout all of the files.

  • All ids must be unique across all files in a single NeTEx delivery for a given version.

  • The version must be a positive whole number (integer) or “any”.

  • The version number must be increased in such a way that the latest version of the object always has the highest number.

  • We recommend using the pattern YYYYMMDDHHmmSS as version if your non-netex objects are already version controlled with "exists from"-dates.

  • The Xmlns value of the Codespace-element is provided by Samtrafiken.

ServiceCalendar and DayTypeAssignment

You must use the <Date> or the <OperatingPeriodRef> element in the DayTypeAssignment when specifying operating days.
We do not support the use of the OperatingDayRef element.

<DayTypeAssignment order="1" version="any" id="SE:253:DayTypeAssignment:1-20191125"> <!-- Choice OperatingDayRef is not allowed --> <Date>2019-11-25</Date> <DayTypeRef ref="SE:253:DayType:1" version="any"/> </DayTypeAssignment> <DayTypeAssignment order="1" version="any" id="SE:253:DayTypeAssignment:2-20191101"> <!-- Choice OperatingDayRef is not allowed --> <OperatingPeriodRef ref="SE:253:OperatingPeriod:Cal20192786-MoWeThFr" version="any"/> <DayTypeRef ref="SE:253:DayType:1" version="any"/> </DayTypeAssignment>

Note: An OperatingPeriod is valid up to the datetime specified in the ToDate, but NOT including that time, see the example below:

JourneyParts and Timingpoints

ServiceFacilities or TrainNumbers can be specified for parts of a journey using JourneyParts, and are defined by two StopPoints and their passing times. See the XML file below for an example.

JourneyParts for TrainNumbers should only be used if the train changes train number during the journey. Otherwise no JourneyPart should be used and the TrainNumber should only be specified on the ServiceJourney.

TimingPoints (where a vehicle does not stop, but is merely passing by at a specified time) are ignored by Samtrafiken. If a JourneyPart begins or ends at a PointInJourneyPattern which is a reference to a TimingPoint, then that JourneyPart will be ignored completely by Samtrafiken.


This element will be used as the announced journey code for the ServiceJourney. This element is optional but if not present there must be either a train number for trains or Line.PublicCode for other public transports available.

Notable requirements on some input values

A few fields have strict requirements on what values that are allowed in them. These requirements are necessary in order for Samtrafiken to be able to use the delivered data.

The most important fields are listed here for clarity. The examples for each file also have comments on fields that have special requirements.

To see requirements for ServiceFacilities, click here.

Mandatory fields with special requirements



Used for




Used for





Max 50 characters

Used as in Samtrafiken's systems.



Must be either

  • a number between 1 and 999998

  • a 9-digit rikshållplatsnumber, such as 740000001

Used as StopArea.Number in Samtrafiken's systems.

If PrivateCode is not supplied, then the last part of the will be tried instead. For example if the StopPlace.PrivateCode is empty and the is: SE:253:StopPlace:174711, then 174711 will be used as StopArea.Number.

The requirement (between 1-999998) remains the same.

When delivering stops using rikshållplatsnumbers, all numbers should already exist as a rikshållplats.


Must be a number between 1 and 9998

Used as Line.Number in Samtrafiken's systems.

This should be unique in combination with the lines TransportOrganisation in the entire dataset.


Required if the ServiceJourney.TransportMode is of type rail.

Max 5 characters

Used as DatedVehicleJourney.AnnouncedTrainNumber in Samtrafiken's systems.

The train number must be specified if the ServiceJourney.TransportMode is of type rail.


Optional fields with special requirements



Used for




Used for




Max 50 characters

Used as in Samtrafikens systems





Max 16 characters

Used as StopArea.ShortName/StopPoint.ShortName in Samtrafikens systems




Max 8 characters





Max 4 characters

Public facing stop point designation. When not present, the local number (auto-increment per StopPlace) is used instead.

Automatically shortened to 4 characters if too long.

For train operators: If the quay is not known (yet), use * as designation.



Max 8 characters


Usually the same as Line.PublicCode



Max 50 characters





Max 5 characters

Public facing journey code. When not present, the first announced train number (for trains) or Line.PublicCode is used.

Import will fail if ServiceJourney.PublicCode is present but empty


This is an example of the _shared_data.xml file with instructions on how the different fields and elements are expected to be used.



This is an example of the _stops.xml file with instructions on how the different fields and elements are expected to be used.



This is an example of a line file with instructions on how the different fields and elements are expected to be used.