mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 01:05:32 +00:00
37 lines
688 B
Go
37 lines
688 B
Go
package xmlmodels
|
|
|
|
import (
|
|
"encoding/json"
|
|
"encoding/xml"
|
|
)
|
|
|
|
type Letter struct {
|
|
XMLName xml.Name `xml:"letterText"`
|
|
Letter int `xml:"letter,attr"`
|
|
Pages []Page `xml:"page"`
|
|
Hands []RefElement `xml:"hand"`
|
|
Content string `xml:",innerxml"`
|
|
Chardata string `xml:",chardata"`
|
|
}
|
|
|
|
func (l Letter) Keys() []any {
|
|
return []any{l.Letter}
|
|
}
|
|
|
|
func (l Letter) Type() string {
|
|
return LETTER
|
|
}
|
|
|
|
func (l Letter) String() string {
|
|
json, err := json.Marshal(l)
|
|
if err != nil {
|
|
return "Cant marshal to json, Letter: " + err.Error()
|
|
}
|
|
return string(json)
|
|
}
|
|
|
|
type Page struct {
|
|
XMLName xml.Name `xml:"page"`
|
|
Index int `xml:"index,attr"`
|
|
}
|