rust-syndication / rss

Library for serializing the RSS web content syndication format
https://crates.io/crates/rss
Apache License 2.0
426 stars 52 forks source link

Channel randomized attribute placement #74

Closed evaldast closed 3 years ago

evaldast commented 5 years ago

Seems like every time a channel is created, it's to_string() value would never be equal to previous channel even if the RSS feed from which both channels were fetched is completely equal.

Calling to_string() on both channels and checking the diff shows me that the attributes placement is randomized. For example:

<atom:link rel="self" type="application/rss+xml" href="link"></atom:link> vs <atom:link href="link"> rel="self" type="application/rss+xml"</atom:link>

As you can see the places of rel and href are swapped.

I would like to be able to compare the channels for equality of RSS either using string or hash comparison. Is there any way to do that currently without going through all the items (no create/update date available to feed)?

tafia commented 5 years ago

I am not sure for rss crate itself but this is not possible direclty through quick-xml which is used internally. Comparing HashSets sounds like the simplest thing to do?

evaldast commented 5 years ago

I am not sure for rss crate itself but this is not possible direclty through quick-xml which is used internally. Comparing HashSets sounds like the simplest thing to do?

Could you elaborate on the HashSets? Is there an easy way to grab XML nodes, store them in HashSets and then compare?