This go package contains a parser for the LENEX file format which is used as exchange format for swim meetings in Europe. The parser will support the current version 3.0 of the LENEX standard.
If you are looking for a DSV parser, check konrad2002/dsvparser
This project is currently under development and might lack some functionalities. Feel free to contribute to the project by opening a pull request or getting in touch with @konrad2002.
Using the encoding/xml
package this project parses the given LENEX XML file and provides data types for all elements from the LENEX standard (see list below).
Everyone is allowed to use this project for commercial and non-commercial usage.
Import the package
go get github.com/konrad2002/lenexparser@v0.1.0
The following example prints a list of all events of a meeting.
import (
...
"github.com/konrad2002/lenexparser/model/elements"
)
func PrintEventList() {
xmlString, err := os.ReadFile("assets/mdm25.lef")
if err != nil {
log.Fatal(err)
}
var lenex elements.Lenex
err = xml.Unmarshal(xmlString, &lenex)
if err != nil {
log.Fatal(err)
}
meet := lenex.Meets[0]
fmt.Printf("Events at '%s %d'\n", meet.Name, meet.Sessions[0].Date.Year())
for _, session := range meet.Sessions {
fmt.Printf("\tSession %d:\n", session.Number)
for _, event := range session.Events {
fmt.Printf("\t\tEvent %d - %s\n", event.Number, event.SwimStyle.Name)
}
}
}
LENEX is an UTF-8 encoded XML file that is used as an exchange file for European swim meetings. LENEX files can occur in uncompressed way as .lef
files as well as the compressed .lxf
archive. Since March 2010 the current standard 3.0 exists and is valid. LENEX stands for "Ligue Européenne de Natation Exchange Format". The Specifications regarding LENEX can be found 🔗 here.
Lenex has a list of used data types. These are converted to the following Go data types:
LENEX | short | Go | Notes |
---|---|---|---|
Currency | c | int |
|
Date | d | parser.CustomTime |
|
Daytime | t | parser.CustomTime |
|
Enumeration | e | const () |
|
Number | n | int |
|
Global Identifier | uuid | string |
|
String | s | string |
special character entities will be replaced, see XML char entity references |
String international | si | string |
|
Swim time | st | parser.SwimTime |
|
Timestamp | ts | parser.CustomTime |
|
Reaction time | rt | parser.SwimTime |
|
Unique id | uid | string |
Item | Item | Item |
---|---|---|
✅ AGEDATE | ✅ HANDICAP | ✅ RECORDLIST |
✅ AGEGROUP | ✅ HEAT | ✅ RELAY |
✅ ATHLETE | ✅ JUDGE | ✅ RELAYPOSITION |
✅ BANK | ✅ LENEX | ✅ RESULT |
✅ CLUB | ✅ MEET | ✅ SESSION |
✅ COACH | ✅ MEETINFO | ✅ SPLIT |
✅ CONSTRUCTOR | ✅ OFFICIAL | ✅ SWIMSTYLE |
✅ CONTACT | ✅ POINTTABLE | ✅ TIMESTANDARD |
✅ ENTRY | ✅ POOL | ✅ TIMESTANDARDLIST |
✅ EVENT | ✅ QUALIFY | ✅ TIMESTANDARDREF |
✅ FACILITY | ✅ RANKING | |
✅ FEE | ✅ RECORD |
During the development and improvement of SwimResults we needed to parse LENEX files. In this repository a LENEX file parser is developed independently from SwimResults.
- add all elements
- add all enums
- parser for time, date and swim time
- add example LENEX file
- data types in README.md
- add types:
- contact
- add README.md