FSharp.XExtensions

Package Description


Keywords
F#, FSharp, functional, programming, xml, xelement, xnode, xdocument, system.xml.linq
License
CC0-1.0
Install
Install-Package FSharp.XExtensions -Version 1.1.0

Documentation

FSharp.XExtensions

I got fed up of having to write XName.Get so I wrote this library. This library gives all of the classes in the System.Xml.Linq namespace overloads for methods that take XNames to take strings instead.

Why?

In C#, strings are allowed to be implicitly converted into XNames.

public XAttribute Foobar(XElement element) => element.Attribute("attr" /* implict conversion */);

This is not the case in F#, making code that deals with XML quite non-ergonomic at times.

let Foobar (element: XElement) = element.Attribute "attr" // Compile error

The overloads help compensate for this.

open FSharp.XExtensions
let Foobar (element: XElement) = element.Attribute "attr" // Hoorah!

NuGet

https://www.nuget.org/packages/FSharp.XExtensions

Contributing

Pull requests welcome!

License

Creative Commons Zero v1.0 Universal. Go nuts.