Skip to content

Instantly share code, notes, and snippets.

@caseywatson
Created May 13, 2013 19:36
Show Gist options
  • Select an option

  • Save caseywatson/5570865 to your computer and use it in GitHub Desktop.

Select an option

Save caseywatson/5570865 to your computer and use it in GitHub Desktop.
public static bool IsValidXmlDocument(this string source)
{
try
{
var document = XDocument.Parse(source);
return true;
}
catch
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment