-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.go
80 lines (71 loc) · 2.83 KB
/
package.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package epub
import "encoding/xml"
type Package struct {
XMLName xml.Name `xml:"package"`
Metadata *Metadata `xml:"metadata"`
Manifest *Manifest `xml:"manifest"`
Version string `xml:"version,attr"`
UniqueIdentifier string `xml:"unique-identifier,attr"`
ID string `xml:"id,attr,omitempty"`
Prefix string `xml:"prefix,attr,omitempty"`
Lang string `xml:"lang,attr,omitempty"`
Dir string `xml:"dir,attr,omitempty"`
}
type ID struct {
Id string `xml:"id,attr,omitempty"`
Text string `xml:",chardata"`
}
type DefaultAttributes struct {
Id string `xml:"id,attr,omitempty"`
Dir string `xml:"dir,attr,omitempty"`
Lang string `xml:"lang,attr,omitempty"`
Text string `xml:",chardata"`
}
type Manifest struct {
Id string `xml:"id,attr,omitempty"`
Item *[]Item `xml:"item"`
}
type Item struct {
Id string `xml:"id,attr"`
Href string `xml:"href,attr"`
MediaType string `xml:"media-type,attr"`
Fallback string `xml:"fallback,attr,omitempty"`
MediaOverlay string `xml:"media-overlay,attr,omitempty"`
Properties string `xml:"properties,attr,omitempty"`
}
type Metadata struct {
Identifier *[]ID `xml:"identifier"`
Language *[]ID `xml:"language"`
Title *[]DefaultAttributes `xml:"title"`
Meta *[]Meta `xml:"meta"`
Date *[]ID `xml:"date,omitempty"`
Type *[]ID `xml:"type,omitempty"`
Contributor *[]DefaultAttributes `xml:"contributor,omitempty"`
Coverage *[]DefaultAttributes `xml:"coverage,omitempty"`
Creator *[]DefaultAttributes `xml:"creator,omitempty"`
Description *[]DefaultAttributes `xml:"description,omitempty"`
Publisher *[]DefaultAttributes `xml:"publisher,omitempty"`
Relation *[]DefaultAttributes `xml:"relation,omitempty"`
Rights *[]DefaultAttributes `xml:"rights,omitempty"`
Subject *[]DefaultAttributes `xml:"subject,omitempty"`
Link *[]Link `xml:"link,omitempty"`
}
type Link struct {
Href string `xml:"href,attr"`
Rel string `xml:"rel,attr"`
Id string `xml:"id,attr,omitempty"`
MediaType string `xml:"media-type,attr,omitempty"`
Properties string `xml:"properties,attr,omitempty"`
Refines string `xml:"refines,attr,omitempty"`
}
type Meta struct {
Id string `xml:"id,attr,omitempty"`
Dir string `xml:"dir,attr,omitempty"`
Lang string `xml:"lang,attr,omitempty"`
Property string `xml:"property,attr,omitempty"` //omitempty because the deprecated meta has no property
Refines string `xml:"refines,attr,omitempty"`
Scheme string `xml:"scheme,attr,omitempty"`
Name string `xml:"name,attr,omitempty"` //deprecated
Content string `xml:"content,attr,omitempty"` //deprecated
Text string `xml:",chardata"`
}