Skip to content

entur/netex-java-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

457 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netex-java-model

Build and push Maven Central Maven Snapshots License: EUPL-1.2 Java 11+

Java model classes generated from NeTEx (Network Timetable Exchange) XML Schema Definition (XSD) files using JAXB. Maintained by Entur AS.

Overview

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

Usage

Release (Maven Central)

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

See Maven Central for the latest released version.

Snapshot

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>

Building from Source

Prerequisites

  • Java 11+
  • Maven 3.x
  • xmlstarlet (apt install xmlstarlet on Debian/Ubuntu, brew install xmlstarlet on macOS)

Build

# 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 -DskipTests

The 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/.

Project Structure

├── 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

Key Technical Details

JAXB customizations (bindings.xjb):

  • Java 8 time type adapters (LocalDateTime, LocalTime, Duration) via threeten-jaxb-core
  • Fluent builder API (withX() methods) via jaxb-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.

License

Licensed under the European Union Public Licence (EUPL) version 1.2.

Related Projects

About

Java JAXB binding classes for NeTEx xsd schema

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors