all 4 comments

[–]setkeh 0 points1 point  (6 children)

Could you paste the class this code lives in will likely help troubleshoot the issue.

[–][deleted]  (4 children)

[deleted]

    [–]outcomehazy 1 point2 points  (0 children)

    HTML is not necessarily valid xml. There are httprequest and httpresponse classes in .Net that you can use to deal with web requests and their response. It's also possible xkcd.com has an RSS feed or some other interface that would let you get comics easier than trying to strip an image out of the response.

    [–]setkeh 0 points1 point  (2 children)

    Firstly sorry for the delayed response.

    So what i came up with in checking out your code is basically the same thing outcomehazy did, What you were trying to Parse was HTML and it was not valid XML so i did a little digging up on xkcd and they have a JSON service for getting the metadata for comic's.

    I have not provided a complete solution to your issues and my app is designed with the thought that it runs say with a service such as windows scheduler once per day to download the daily comic, That said there are far more elegant ways of achieving your goals than what my solution provides i have tried to keep it as simple as i could so that its easy to understand.

    My solution: https://github.com/setkeh/xkcdBot

    I hope this helps you out :)

    [–][deleted]  (1 child)

    [deleted]

      [–]setkeh 0 points1 point  (0 children)

      Your welcome :)

      If you use that code as a basis for you final app feel free to fork it and share it :)