An open API service indexing awesome lists of open source software.

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

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)