-
Notifications
You must be signed in to change notification settings - Fork 1
/
topic.go
49 lines (40 loc) · 1.05 KB
/
topic.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
package dita
import (
"encoding/xml"
)
type Topic struct {
XMLName xml.Name
ID string `xml:"id,attr"`
Title string `xml:"title"`
NavTitle string `xml:"titlealts>navtitle"`
Prolog Prolog `xml:"prolog"`
ShortDesc InnerXML `xml:"shortdesc"`
RelatedLink []Link `xml:"related-links>link"`
Elements []Body `xml:",any"`
}
type Prolog struct {
Keywords []string `xml:"metadata>keywords>keyword"`
OtherMeta []OtherMeta `xml:"metadata>othermeta"`
ResourceID []struct {
Name string `xml:"id,attr"`
} `xml:"resourceid"`
}
type InnerXML struct {
XMLName xml.Name
Content string `xml:",innerxml"`
}
func (x *InnerXML) Text() (string, error) { return xmlstriptags(x.Content) }
type Body struct {
XMLName xml.Name
Content string `xml:",innerxml"`
}
type Link struct {
Href string `xml:"href,attr"`
Format string `xml:"format,attr,omitempty"`
Scope string `xml:"scope,attr,omitempty"`
Text string `xml:"linktext,omitempty"`
}
type OtherMeta struct {
Name string `xml:"name,attr"`
Content string `xml:"content,attr"`
}