Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Support Syndication Support Rss Optional Elements#26612

Merged
mconnew merged 10 commits intodotnet:masterfrom
mconnew:RssOptionalElements
Mar 3, 2018
Merged

Support Syndication Support Rss Optional Elements#26612
mconnew merged 10 commits intodotnet:masterfrom
mconnew:RssOptionalElements

Conversation

@mconnew
Copy link
Member

@mconnew mconnew commented Jan 27, 2018

Implementation and tests for supporting some RSS elements which we didn't previously support. This adds support for the following RSS feed elements:

  • <docs> Link to Uri explaining feed schema - Documentation
  • <skipDays> List of days for an aggregator to skip fetching - SkipDays
  • <skipHours> List of hours for an aggregator to not fetch the feed - SkipHours
  • <textInput> Describes an input field and url to submit some data to - TextInput
  • <ttl> How long the feed should be considered valid in a cache - TimeToLive
    The TextInput is of type SyndicationTextInput which contains 4 fields matching the RSS spec. See here for details.

The API review for this change is #25718 and has been approved. This PR replaces #25625
Fixes #25718

@mconnew mconnew requested review from MSGaryWang and zhenlan January 27, 2018 01:29
}
else
{
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This could be simplified, e.g.:

using (XmlReader reader = timeToLiveElement.GetReader())
{
    string value = reader.ReadElementString();
    if (int.TryParse(value, out int timeToLive) && timeToLive >= 0)
    {
        return TimeSpan.FromMinutes(timeToLive);
    }

    return null;
}

{
if (value.HasValue && (value.Value.Milliseconds != 0 || value.Value.Seconds != 0 || value.Value.TotalMinutes < 0))
{
throw new ArgumentOutOfRangeException(nameof(value), value.Value, SR.InvalidTimeToLiveValue);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might use nameof(TimeToLive) here

}

private SyndicationLink ReadAlternateLink(XmlReader reader, Uri baseUri)
internal static SyndicationLink ReadAlternateLink(XmlReader reader, Uri baseUri, Func<string, UriKind, string, string, Uri> uriParser, bool preserveAttributeExtensions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always pass UriParser as uriParser to ReadAlternateLink?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't. We have one case where we are calling it from a context where we don't have a user provided parser so we pass in the default parser.

throw new FormatException(string.Format(SR.InvalidSkipHourValue, value));
}

skipHours.Add(hour);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to consider the duplicated items? Same as skipDays below.

@ahsonkhan
Copy link

@dotnet-bot test NETFX x86 Release Build

@mconnew mconnew force-pushed the RssOptionalElements branch from 8d36aaa to 1c4b8d9 Compare March 3, 2018 02:18
@mconnew
Copy link
Member Author

mconnew commented Mar 3, 2018

Failures on OpenSuse.423, Centos.74 and Ubuntu.1804.
The failures are all SSL based failures in System.Net.Security.Tests and nothing to do with this PR.
OSX failure is test lab issues.

@mconnew mconnew merged commit 924dce0 into dotnet:master Mar 3, 2018
@karelz karelz added this to the 2.1.0 milestone Mar 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants