Java model classes generated from NeTEx (Network Timetable Exchange) XML Schema Definition (XSD) files using JAXB. Maintained by Entur AS.
This library downloads the NeTEx XSD files from the Entur NeTEx fork and compiles them into JAXB-annotated Java model classes at build time. The generated classes support full marshalling and unmarshalling of NeTEx XML documents, including schema validation against multiple NeTEx versions.
- NeTEx version: 1.16 (model generation), with legacy validation support back to 1.07
- JAXB: Jakarta XML Bind 4.x (Jakarta EE 9+)
- Generated package:
org.rutebanken.netex.model - GML types package:
net.opengis.gml._3
<dependency>
<groupId>org.entur</groupId>
<artifactId>netex-java-model</artifactId>
<version>LATEST</version>
</dependency>See Maven Central for the latest released version.
Snapshots are published to the Sonatype snapshot repository. Add the repository to your pom.xml:
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>Then add the dependency with the snapshot version:
<dependency>
<groupId>org.entur</groupId>
<artifactId>netex-java-model</artifactId>
<version>LATEST-SNAPSHOT</version>
</dependency>- Java 11+
- Maven 3.x
xmlstarlet(apt install xmlstarleton Debian/Ubuntu,brew install xmlstarleton macOS)
# Full build: downloads XSD files, generates JAXB classes, compiles, runs tests
mvn clean install
# Run tests only
mvn test
# Package without running tests
mvn package -DskipTestsThe XSD files are downloaded from GitHub during the generate-sources phase and placed under src/main/resources/xsd/. The JAXB model is generated into target/generated-sources/xjc/.
├── bin/
│ ├── netex-download-extract.sh # Downloads NeTEx XSD from GitHub
│ ├── annotation-replacer.sh # Post-processes generated Java files
│ └── version_updater.sh # Updates version references in bindings
├── bindings.xjb # JAXB customization bindings
├── src/main/java/org/rutebanken/
│ ├── netex/ # NeTEx utilities (validation, toString style)
│ └── util/ # XML adapters for Java time types
├── src/main/resources/xsd/ # Downloaded NeTEx XSD files (build artifact)
└── src/test/ # JUnit 5 marshalling/unmarshalling tests
JAXB customizations (bindings.xjb):
- Java 8 time type adapters (
LocalDateTime,LocalTime,Duration) viathreeten-jaxb-core - Fluent builder API (
withX()methods) viajaxb-fluent-api - Property name conflict resolution
- Package mapping to
org.rutebanken.netex.model
Schema validation: NeTExValidator supports validation against NeTEx versions 1.07 through 1.16.
Note on GML types: This library generates classes under net.opengis.gml._3 as part of the NeTEx model.
Licensed under the European Union Public Licence (EUPL) version 1.2.
- netex-protobuf — NeTEx XSD files converted to protobuf descriptors
- NeTEx (Entur fork) — NeTEx XSD source files used by this library