mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
XML parsing overhaul
This commit is contained in:
@@ -5,15 +5,6 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type PlaceProvider struct {
|
||||
XMLProvider[Places]
|
||||
}
|
||||
|
||||
type Places struct {
|
||||
XMLName xml.Name `xml:"orte"`
|
||||
Place []Place `xml:"ort"`
|
||||
}
|
||||
|
||||
type Place struct {
|
||||
XMLName xml.Name `xml:"ort"`
|
||||
Names []string `xml:"name"`
|
||||
@@ -23,24 +14,6 @@ type Place struct {
|
||||
AnnotationNote
|
||||
}
|
||||
|
||||
func (p Places) Append(data Places) Places {
|
||||
p.Place = append(p.Place, data.Place...)
|
||||
return p
|
||||
}
|
||||
|
||||
func (p Places) String() string {
|
||||
var res []string
|
||||
for _, place := range p.Place {
|
||||
res = append(res, place.String())
|
||||
}
|
||||
|
||||
return fmt.Sprintf("Places: %v", res)
|
||||
}
|
||||
|
||||
func (p *Place) String() string {
|
||||
func (p Place) String() string {
|
||||
return fmt.Sprintf("ID: %s\nNames: %v\nSortName: %s\nGeo: %s\nAnnotations: %v\nNotes: %v\n", p.ID, p.Names, p.SortName, p.Geo, p.Annotations, p.Notes)
|
||||
}
|
||||
|
||||
func NewPlaceProvider(paths []string) *PlaceProvider {
|
||||
return &PlaceProvider{XMLProvider: XMLProvider[Places]{paths: paths}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user