anchor.diff:  ﻿namespace FSharp.Data
  -
  -// TODO: document all of these
   
   open System
   open System.IO
  
positive.code:                     ]
              descendantsBy f x
      
          let descendantsNamed names x = 
              let nameSet = Set.ofSeq (names |> Seq.map (fun (n:string) -> n.ToLowerInvariant()))
              descendants (fun x -> name x |> nameSet.Contains) x
      
          let hasDescendants names x = 
              let nameSet = Set.ofSeq (names |> Seq.map (fun (n:string) -> n.ToLowerInvariant()))
              descendants (fun x -> nameSet.Contains(name x)) x |> Seq.isEmpty |> not
           
          let tryGetAttribute (name:string) = function
              | HtmlElement(_,_,attr,_) -> attr |> List.tryFind (fun a -> a.Name.ToLowerInvariant() = (name.ToLowerInvariant()))
              | _ -> None   
      
          let getAttributeValue defaultValue parseF name x = 
              match tryGetAttribute name x with
              | Some(v) -> v.Value(defaultValue, parseF)
              | None -> defaultValue
      
          let attribute name x = 
              match tryGetAttribute name x with
              | Some(v) -> v
  
negative.code: 
  module Html =
      module HtmlAttribute = 
          ///<summary>
          ///Gets the name of the given attribute
          /// </summary>
          let name = function
              | HtmlAttribute(name = name) -> name
  
          ///<summary>
          ///Gets the values of the given attribute
          /// </summary>
          let value = function
              | HtmlAttribute(value = value) -> value   
  
          ///<summary>
          ///Parses the value of the attribute using the given function
          /// </summary>
          let parseValue parseF attr = 
              value attr |> parseF
  
          ///<summary>
          ///Attempts to parse the value of the attribute using the given function
          ///if the parse functions fails the defaultValue is returned
          /// </summary>
          let tryParseValue defaultValue parseF attr = 
              match value attr |> parseF with
              | true, v -> v
              | false, _ -> defaultValue
      
      type HtmlAttribute with
          /// <summary>
          /// Gets the name of the current attribute
          /// </summary>
          member x.Name with get() = HtmlAttribute.name x
  
          /// <summary>
          /// Gets the value of the current attribute
          /// </summary>
          member x.Value() = HtmlAttribute.value x
  
          /// <summary>
          /// Gets the value of the current attribute and parses the value
          /// using the function supplied by parseF
          /// </summary>
          /// <param name="parseF">The function to parse the attribute value</param>
          member x.Value<'a>(parseF : string -> 'a)= 
              HtmlAttribute.parseValue parseF x
  
          /// <summary>
          /// Attempts to parse the attribute value using the given function
          /// if the parse function returns false then the defaultValue is used
          /// </summary>
          /// <param name="defaultValue">Value to return if the parse function fails</param>
          /// <param name="parseF">Function to parse the attribute value</param>
          member x.Value<'a>(defaultValue, parseF : string -> (bool * 'a))= 
              HtmlAttribute.tryParseValue defaultValue parseF x
      
      module HtmlNode = 
          
          /// <summary>
          /// Gets the given nodes name
          /// </summary>
          let name = function
              | HtmlElement(_, name, _, _) -> name.ToLowerInvariant()
              | HtmlContent(_, HtmlContentType.Script, _ ) -> "script"
              | HtmlContent(_, HtmlContentType.Style, _) -> "style"
              | _ -> String.Empty
              
          /// <summary>
          /// Gets all of the nodes immediately under this node
          /// </summary>
          let children = function 
              | HtmlElement(_, _, _, children) -> children
              | _ -> []
      
          /// <summary>
          /// Gets the parent node of this node
          /// </summary>
          let parent = function
              | HtmlElement(parent = parent) 
              | HtmlContent(parent = parent) -> !parent
          
          /// <summary>
          /// Gets all of the descendants of this node that statisfy the given predicate
          /// the current node is also considered in the comparison
          /// </summary>
          /// <param name="f">The predicate by which to match the nodes to return</param>
          /// <param name="x">The given node</param>
          let descendantsAndSelf f x = 
              let rec descendantsBy f (x:HtmlNode) =
                      [   
  