Elements that contain multiple CDATA sections are overwritten. Fix is
submitted to go-pkg-xmlx
This commit is contained in:
parent
583ce7f9e9
commit
ae2d31d0ff
12
feed_test.go
12
feed_test.go
|
@ -56,6 +56,18 @@ func Test_RssAuthor(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func Test_CData(t *testing.T) {
|
||||
content, _ := ioutil.ReadFile("testdata/iosBoardGameGeek.rss")
|
||||
feed := New(1, true, chanHandler, itemHandler)
|
||||
feed.FetchBytes("http://example.com", content, nil)
|
||||
|
||||
item := items[0]
|
||||
expected := `<p>abc<div>"def"</div>ghi`
|
||||
if item.Description != expected {
|
||||
t.Errorf("Expected item.Description to be [%s] but item.Description=[%s]", expected, item.Description)
|
||||
}
|
||||
}
|
||||
|
||||
func chanHandler(feed *Feed, newchannels []*Channel) {
|
||||
println(len(newchannels), "new channel(s) in", feed.Url)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0"?><rss version="2.0"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
|
||||
<channel>
|
||||
<title>iOS Board Games | BoardGameGeek</title>
|
||||
<image>
|
||||
<url>http://geekdo-images.com/images/geeksm.gif</url>
|
||||
<link>http://boardgamegeek.com/</link>
|
||||
<title>iOS Board Games | BoardGameGeek</title>
|
||||
</image>
|
||||
<description>BoardGameGeek features information related to the board gaming hobby</description>
|
||||
<language>en-us</language>
|
||||
<pubDate>Thu, 28 Mar 2013 14:51:20 +0000</pubDate>
|
||||
<lastBuildDate>Thu, 28 Mar 2013 14:51:20 +0000</lastBuildDate>
|
||||
<link>http://boardgamegeek.com/</link>
|
||||
<webMaster>webmaster@boardgamegeek.com</webMaster>
|
||||
|
||||
<item>
|
||||
<title>iOS News: Stone Age 2.0 Released, Ravensburger March Sale Features San Juan, More Info on Las Vegas, Shifts Gets an Update and more...</title>
|
||||
<description><p>abc<![CDATA[<div>"def"</div>]]>ghi
|
||||
</description>
|
||||
<link>http://boardgamegeek.com/blogpost/18194/ios-news-stone-age-2-0-released-ravensburger-march</link>
|
||||
<guid>http://boardgamegeek.com/blogpost/18194/ios-news-stone-age-2-0-released-ravensburger-march</guid>
|
||||
<pubDate>Thu, 28 Mar 2013 14:51:20 +0000</pubDate>
|
||||
<dc:creator>Neumannium</dc:creator>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
Loading…
Reference in New Issue