Added additional precondition checks to the XDocument assertions. #27