I'm trying to touch some F# language by developing a small "web crawler". I've got a functions declared like this:
let results = HtmlDocument.Load("http://joemonster.org//")
let images =
results.Descendants ["img"]
|> Seq.map (fun x ->
x.TryGetAttribute("src").Value.Value(),
x.TryGetAttribute("alt").Value.Value()
)
which of course should return for me a map of "src" and "alt" attributes for "img" tag. But when I'm encountering a situation when one of those are missing in the tag I'm getting an exception that TryGetAttribute is returning null. I want to change that function to return the attribute value or empty string in case of null. I've tried out answers from this ticket but with no success.