tags:

views:

44

answers:

1

I'm looking for some code in .net to allow me to test an xml file to determine if it is well-formed. I am not validating the file against a schema at this point in my code, just testing that it conforms to xml specification for being well formed.

Any assistance is appreciated.

+4  A: 

Just try parsing the XML into an XMLDocument and see if it throws.

Pierreten
Thanks for your answer. After asking the above question, I found this stackoverflow question that didn't show up in my initial search: http://stackoverflow.com/questions/1026247/check-well-formed-xml-without-a-try-catch
CletusLoomis