Created
October 4, 2012 10:28
-
-
Save rarous/3832779 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var items = CreateRequestUris(requestXml). | |
| Select(Downloader.Download). | |
| SelectMany(Parse); | |
| return new Response(TransformResult(items)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| readonly ReplaySubject<string> urlSubject = new ReplaySubject<string>(); | |
| protected override IEnumerable<string> CreateRequestUris(XmlElement requestXml) | |
| { | |
| urlSubject.OnNext(ListUrl); | |
| return urlSubject.ToEnumerable(); | |
| } | |
| protected override IEnumerable<Data> Parse(string text) | |
| { | |
| var html = text.ParseHtml(); | |
| NotifyNextPage(html); | |
| // ... | |
| return from row in rows select Data.Parse(row); | |
| } | |
| void NotifyNextPage(XElement html) | |
| { | |
| var formData = ParseFormData(html); | |
| if (formData != null) | |
| urlSubject.OnNext(ListUrl + formData); | |
| else | |
| urlSubject.OnCompleted(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment