Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8949919
Upgrade to NeTEx 2.0 schema
vpaturet Feb 3, 2026
a1c99fb
Download NeTEx XSD from the TransmodelEcosystem repository
vpaturet Sep 24, 2026
d4d3c4b
Turn netex-java-model into a JPMS module
t2gran Sep 21, 2026
952c8f2
Update CLAUDE.md for the JPMS module and the netex.util package rename
vpaturet Sep 25, 2026
97dd38f
Change Maven coordinates to org.entur:netex2-java-model
vpaturet Oct 13, 2026
e3716a4
Change base package from org.rutebanken.netex to org.entur.netex2
vpaturet Oct 13, 2026
e07ba16
Map xsd:date to java.time.LocalDate
vpaturet Oct 13, 2026
ef56abd
Remove stray '|' character from bindings.xjb
vpaturet Oct 13, 2026
0744e76
Fix outdated Java version and schema sources in CLAUDE.md
vpaturet Oct 13, 2026
207d7ae
Drop the deprecated NetexVersion.v1_16_1
vpaturet Oct 13, 2026
707d9de
Build fallback release workflows with Java 21
vpaturet Oct 13, 2026
74769bb
Upgrade JUnit to 6.1.3 and remove the Renovate pin
vpaturet Oct 13, 2026
c11932e
Fix README drift after the 3.0 changes
vpaturet Oct 13, 2026
9df6596
Upgrade CXF XJC to 4.2.0 and drop the Renovate pin
vpaturet Oct 13, 2026
078f54f
Drop the cxf-xjc-runtime dependency
vpaturet Oct 13, 2026
bc1a231
Export org.entur.netex2.util only to the JAXB modules
vpaturet Oct 13, 2026
b43c088
Make the NeTExValidator constructors private
vpaturet Oct 13, 2026
7856b09
Stop exporting org.entur.netex2
vpaturet Oct 13, 2026
6cc3657
Remove pre-JReleaser relics from the pom
vpaturet Oct 13, 2026
23d8a26
Delete the downloaded XSD directory on mvn clean
vpaturet Oct 13, 2026
e934837
Fix IntelliJ inspection findings in the handwritten sources
vpaturet Oct 13, 2026
ce96e3f
Make OmitNullsToStringStyle final with a private constructor
vpaturet Oct 13, 2026
2440b25
Fix the Sonar code smells in the tests
vpaturet Oct 13, 2026
151467f
Remove the dead offset default from the date-time and time adapters
vpaturet Oct 13, 2026
69e0e2d
Drop release-plugin and shade-plugin entries from .gitignore
vpaturet Oct 13, 2026
f4788fe
Use getFirst() instead of get(0) in the tests
vpaturet Oct 13, 2026
918e526
Hide the _Dummy suffix of the NeTEx 2.0 substitution-group heads
vpaturet Oct 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
sudo apt-get -y install xmlstarlet
- uses: actions/setup-java@v6.0.1
with:
java-version: 17
java-version: 21
distribution: liberica
- name: Cache Maven dependencies
uses: actions/cache@v6.1.0
Expand Down Expand Up @@ -75,6 +75,6 @@ jobs:
version: ${{ needs.maven-verify.outputs.version }}
snapshot: true
skip_version_update: true
java_version: 11
java_version: 21
java_distribution: liberica
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/hotfix-finish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:

- **Hotfix Version:** $VERSION
- **Git Tag:** \`v${VERSION}\`
- **Maven Central (netex-java-model):** https://central.sonatype.com/artifact/org.entur/netex-java-model/${VERSION}
- **Maven Central (netex2-java-model):** https://central.sonatype.com/artifact/org.entur/netex2-java-model/${VERSION}
- **Hotfix Branch:** Deleted
- **Merged to master:** ${{ inputs.merge_to_master }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hotfix-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- uses: actions/setup-java@v6.0.1
with:
java-version: 11
java-version: 21
distribution: liberica
cache: maven

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-finish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ jobs:

- **Released Version:** $VERSION
- **Git Tag:** \`v${VERSION}\`
- **Maven Central (netex-java-model):** https://central.sonatype.com/artifact/org.entur/netex-java-model/${VERSION}
- **Maven Central (netex2-java-model):** https://central.sonatype.com/artifact/org.entur/netex2-java-model/${VERSION}
- **Next Development Version ($BASE_BRANCH):** ${{ steps.next_version.outputs.next_version }}
- **Release Branch:** Merged to $BASE_BRANCH and deleted

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- uses: actions/setup-java@v6.0.1
with:
java-version: 11
java-version: 21
distribution: liberica
cache: maven

Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
profile
.idea
*.iml
Expand Down
22 changes: 12 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

**netex-java-model** is a Java library that generates JAXB model classes from NeTEx (Network Timetable Exchange) XML Schema Definition (XSD) files. The XSD files are downloaded from https://github.com/entur/NeTEx and compiled into Java classes at build time.
**netex2-java-model** (Maven coordinates `org.entur:netex2-java-model`) is a Java library that generates JAXB model classes from NeTEx (Network Timetable Exchange) XML Schema Definition (XSD) files. The NeTEx 2.0 XSD is downloaded from https://github.com/TransmodelEcosystem/NeTEx and compiled into Java classes at build time. The legacy schemas used only for validation (1.04beta - 1.16.1) are downloaded from the Entur fork at https://github.com/entur/NeTEx.

- **Organization**: Entur AS (Norwegian public transport data provider)
- **License**: EUPL-1.2
- **Java Version**: 11+ (builds on 17 in CI)
- **Package**: `org.rutebanken.netex.model` (generated), `org.rutebanken.netex` and `org.rutebanken.util` (source)
- **Java Version**: 21+ (builds and publishes on 21 in CI)
- **Package**: `org.entur.netex2.model` (generated), `org.entur.netex2`, `org.entur.netex2.client`, `org.entur.netex2.validation` and `org.entur.netex2.util` (source). GML and SIRI types are generated in `net.opengis.gml._3` and `uk.org.siri.siri`.

## Build Commands

Expand Down Expand Up @@ -37,9 +37,10 @@ mvn validate
│ ├── annotation-replacer.sh # Post-processes generated Java files
│ └── version_updater.sh # Updates version references
├── bindings.xjb # JAXB customization bindings
├── src/main/java/org/rutebanken/
│ ├── netex/ # Utilities (validation, client, toString style)
│ └── util/ # XML adapters for Java 8 time types
├── src/main/java/
│ ├── module-info.java # JPMS module descriptor (org.entur.netex2)
│ └── org/entur/netex2/ # Utilities (validation, client, toString style)
│ └── util/ # XML adapters for Java 8 time types
├── src/main/resources/xsd/ # NeTEx XSD files (downloaded at build time)
├── src/test/ # JUnit 5 tests for marshalling/unmarshalling
└── target/generated-sources/ # JAXB-generated model classes (build artifact)
Expand All @@ -48,15 +49,16 @@ mvn validate
## Key Technical Details

- **JAXB Bindings**: The `bindings.xjb` file customizes code generation, including:
- Java 8 time type adapters (`LocalDateTime`, `LocalTime`, `Duration`)
- Java 8 time type adapters (`LocalDateTime`, `LocalDate`, `LocalTime`, `Duration`)
- Property name conflict resolution
- Package naming (`org.rutebanken.netex.model`)
- Package naming (`org.entur.netex2.model`)
- A generated block (between `BEGIN/END generated _Dummy bindings` markers) that hides the `_Dummy` suffix of the abstract substitution-group heads: `getDayType()` instead of `getDayType_Dummy()`, `createDayType_(...)` in `ObjectFactory`. Do not edit the block by hand; rerun `bin/generate-dummy-bindings.py src/main/resources/xsd/<version>/NeTEx_publication.xsd bindings.xjb` after a schema upgrade.

- **Generated Code**: Model classes are generated in `target/generated-sources/` during build. Do not manually edit generated code.

- **NeTEx Version**: Configured in `pom.xml` via `<netexVersion>` property (currently 1.16).
- **NeTEx Version**: Configured in `pom.xml` via `<netexVersion>` property (currently 2.0).

- **Validation**: `NeTExValidator` class provides XML schema validation against NeTEx XSD.
- **Validation**: `NeTExValidator` class provides XML schema validation against NeTEx XSD, for versions 1.04beta through 2.0. Documents declaring 1.16 are validated against the 1.16.1 schema.

## CI/CD

Expand Down
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# netex-java-model
# netex2-java-model

[![Build and push](https://github.com/entur/netex-java-model/actions/workflows/deploy.yml/badge.svg)](https://github.com/entur/netex-java-model/actions/workflows/deploy.yml)
[![Maven Central](https://img.shields.io/maven-central/v/org.entur/netex-java-model.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.entur/netex-java-model)
[![Maven Snapshots](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Forg%2Fentur%2Fnetex-java-model%2Fmaven-metadata.xml&label=Snapshot)](https://central.sonatype.com/repository/maven-snapshots)
[![Maven Central](https://img.shields.io/maven-central/v/org.entur/netex2-java-model.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.entur/netex2-java-model)
[![Maven Snapshots](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Forg%2Fentur%2Fnetex2-java-model%2Fmaven-metadata.xml&label=Snapshot)](https://central.sonatype.com/repository/maven-snapshots)
[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](https://joinup.ec.europa.eu/software/page/eupl)
[![Java 11+](https://img.shields.io/badge/Java-11%2B-orange)](https://adoptium.net/)
[![Java 21+](https://img.shields.io/badge/Java-21%2B-orange)](https://adoptium.net/)

Java model classes generated from [NeTEx](https://github.com/entur/NeTEx) (Network Timetable Exchange) XML Schema Definition (XSD) files using JAXB. Maintained by [Entur AS](https://www.entur.org).
Java model classes generated from [NeTEx](https://github.com/TransmodelEcosystem/NeTEx) (Network Timetable Exchange) XML Schema Definition (XSD) files using JAXB. Maintained by [Entur AS](https://www.entur.org).

## Overview

This library downloads the NeTEx XSD files from the [Entur NeTEx fork](https://github.com/entur/NeTEx) 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.
This library downloads the NeTEx XSD files from the [NeTEx repository](https://github.com/TransmodelEcosystem/NeTEx) 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. The legacy schemas used only for validation (1.04beta - 1.16.1) are downloaded from the [Entur NeTEx fork](https://github.com/entur/NeTEx).

- **NeTEx version**: 1.16.1 (model generation), with legacy validation support back to 1.07
- **NeTEx version**: 2.0 (model generation), with legacy validation support back to 1.04beta
- **JAXB**: Jakarta XML Bind 4.x (Jakarta EE 9+)
- **Generated package**: `org.rutebanken.netex.model`
- **Generated package**: `org.entur.netex2.model`
- **GML types package**: `net.opengis.gml._3`
- **SIRI types package**: `uk.org.siri.siri`
- **JPMS module**: `org.entur.netex2`

## Usage

Expand All @@ -24,12 +26,12 @@ This library downloads the NeTEx XSD files from the [Entur NeTEx fork](https://g
```xml
<dependency>
<groupId>org.entur</groupId>
<artifactId>netex-java-model</artifactId>
<artifactId>netex2-java-model</artifactId>
<version>LATEST</version>
</dependency>
```

See [Maven Central](https://central.sonatype.com/artifact/org.entur/netex-java-model) for the latest released version.
See [Maven Central](https://central.sonatype.com/artifact/org.entur/netex2-java-model) for the latest released version.

### Snapshot

Expand All @@ -52,7 +54,7 @@ Then add the dependency with the snapshot version:
```xml
<dependency>
<groupId>org.entur</groupId>
<artifactId>netex-java-model</artifactId>
<artifactId>netex2-java-model</artifactId>
<version>LATEST-SNAPSHOT</version>
</dependency>
```
Expand All @@ -61,7 +63,7 @@ Then add the dependency with the snapshot version:

### Prerequisites

- Java 11+
- Java 21+
- Maven 3.x
- [`xmlstarlet`](https://xmlstar.sourceforge.net/) (`apt install xmlstarlet` on Debian/Ubuntu, `brew install xmlstarlet` on macOS)

Expand All @@ -86,26 +88,28 @@ The XSD files are downloaded from GitHub during the `generate-sources` phase and
├── bin/
│ ├── netex-download-extract.sh # Downloads NeTEx XSD from GitHub
│ ├── annotation-replacer.sh # Post-processes generated Java files
│ ├── generate-dummy-bindings.py # Regenerates the bindings hiding the _Dummy suffix
│ └── 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/java/org/entur/
│ └── netex2/ # NeTEx utilities (validation, client, 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`
- Java time type adapters: `LocalDateTime`, `LocalDate` and `LocalTime` via adapters in `org.entur.netex2.util`, `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`
- Package mapping to `org.entur.netex2.model`
- Hiding of the `_Dummy` suffix that NeTEx 2.0 puts on abstract substitution-group heads (`DayType_Dummy` is the head of `DayType`): containers expose `getDayType()` instead of `getDayType_Dummy()`, `ObjectFactory` exposes `createDayType_(...)` and the few classes generated for such heads keep a trailing underscore, as in `netex-java-model` 2.x. These bindings are generated by `bin/generate-dummy-bindings.py` and must be regenerated when the schema is upgraded.

**Schema validation**: `NeTExValidator` supports validation against NeTEx versions 1.07 through 1.16. A version is validated against its latest patch schema: documents declaring 1.16 are validated against the 1.16.1 schema, which is backward compatible with 1.16.
**Schema validation**: `NeTExValidator` supports validation against NeTEx versions 1.04beta through 2.0. A version is validated against its latest patch schema: documents declaring 1.16 are validated against the 1.16.1 schema, which is backward compatible with 1.16.

**Note on GML types**: This library generates classes under `net.opengis.gml._3` as part of the NeTEx model.
**Note on GML and SIRI types**: This library generates classes under `net.opengis.gml._3` and `uk.org.siri.siri` as part of the NeTEx model. These packages are the same as in `netex-java-model` 2.x, so both libraries can share a classpath but not a module path.

## License

Expand Down
Loading
Loading