https://github.com/orienteering-oss/iof-xml
Java classes generated from IOF XSD v3 and v2
https://github.com/orienteering-oss/iof-xml
iof orienteering unmarshalling xml-parser
Last synced: 5 months ago
JSON representation
Java classes generated from IOF XSD v3 and v2
- Host: GitHub
- URL: https://github.com/orienteering-oss/iof-xml
- Owner: orienteering-oss
- License: gpl-3.0
- Created: 2021-08-27T05:36:18.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2026-01-12T04:47:45.000Z (5 months ago)
- Last Synced: 2026-01-12T13:56:51.967Z (5 months ago)
- Topics: iof, orienteering, unmarshalling, xml-parser
- Language: Java
- Homepage: https://orienteering-oss.github.io/iof-xml
- Size: 8.48 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java / Kotlin IOF XML
Java classes for IOF XML version 2 and 3. Also marshal and unmarshal helper functions for both XML versions.
The folder [./src/main/java](./src/main/java) contains Java files generated from the XSD files for IOF v2 and v3.
They are generated with the Gradle task `addXjcTask` in [`build.gradle`](./build.gradle) (can be run with the
task `generateSources`).
Original XSD files that the Java classes are generated from:
* [iof_v2.xsd](src/main/resources/iof_v2.xsd) (converted from [IOFdata.dtd](src/main/resources/IOFdata.dtd))
* [iof_v3.xsd](src/main/resources/iof_v3.xsd)
See also generated documentation from the source code:
* Javadoc:
* Dokka Kotlin:
## Install and usage
### Install
Install the project by adding the dependency to your pom.xml or build.gradle file.
**pom.xml:**
```xml
io.github.orienteering-oss
iofXml
1.3.6
```
**build.gradle:**
```groovy
implementation group: 'io.github.orienteering-oss', name: 'iofXml', version: '1.3.6'
```
### Usage
```kotlin
import iofXml.marshallIofV3
import iofXml.unmarshalGenericIofV3
import iofXml.v3.StartTimeAllocationRequest
fun main(args: Array) {
// Generic unmarshal, Triple with 'Any' type:
val (obj, xmlTypeName, reflectionClass) = unmarshalGenericIofV3(classListExampleXml)
// Specific unmarshal / deserialize:
val classList = unmarshalIofV3ClassList(classListExampleXml)
println(classList.clazz.first().name)
// prints: Men Open
// Marshal / serialize:
println(marshallIofV3(classList))
// prints original XML file
// Create object of IOF v3 class:
StartTimeAllocationRequest()
}
var classListExampleXml = """
1
Men Open
""".trimIndent()
```
## Development with Gradle
### Run project
```shell
./gradlew run
```
### Run tests
```shell
./gradlew test
```
### (Re-)generate Java sources from XSD files
```shell
./gradlew generateSources
```
### Upload to maven central
(Remember to put a file `gradle.properties` with the required fields (GPG-key and ossrh username and password
see [Signing artifacts](https://docs.gradle.org/current/userguide/publishing_signing.html))
```shell
./gradlew publishMavenJavaPublicationToSonatypeRepository
```
After upload, follow [the release process](https://central.sonatype.org/publish/release/).
## Related
* C# classes for IOF XML v3: [github.com/international-orienteering-federation/Dotnet-Client-IOF.XML.V3](https://github.com/international-orienteering-federation/Dotnet-Client-IOF.XML.V3)
* IOF repository for
* [v2 datastandard](https://github.com/international-orienteering-federation/datastandard-v2)
* [v3 datastandard](https://github.com/international-orienteering-federation/datastandard-v3)