sikkom: maak gebruik van namespaces
This commit is contained in:
@@ -31,7 +31,7 @@ type ItemT struct {
|
||||
PubDate string `xml:"pubDate"`
|
||||
UnixTime int64 `xml:"unixTime"`
|
||||
Guid string `xml:"guid"`
|
||||
Link string `xml:"link"`
|
||||
Link string `xml:"https://www.rssboard.org/rss-specification link"` // i.p.v. atom:link
|
||||
Premium bool `xml:"premium"`
|
||||
Data []byte `xml:",innerxml"`
|
||||
}
|
||||
@@ -94,9 +94,8 @@ func main() {
|
||||
p(err)
|
||||
p(resp.Body.Close())
|
||||
|
||||
b2 := bytes.ReplaceAll(
|
||||
bytes.ReplaceAll(body, []byte("<atom:"), []byte("<atom_")),
|
||||
[]byte("</atom:"), []byte("</atom_"))
|
||||
// zet de default namespace om onderscheid te kunnen maken met overige namespaces
|
||||
b2 := bytes.Replace(body, []byte("<rss"), []byte(`<rss xmlns="https://www.rssboard.org/rss-specification"`), 1)
|
||||
|
||||
var rss Rss
|
||||
p(xml.Unmarshal(b2, &rss))
|
||||
|
||||
Reference in New Issue
Block a user