I have an System.IO.Stream object that may or may 开发者_JAVA技巧not be XML.
What is the quickest/easiest way to determine if 1) Is this file XML and 2) if it is, then is it an instance of a particular schema?
In the end I really just trying to write a method that can return true or false if a particular Stream is an instance of a schema.
Thanks for the help!
I suggest you try to load is an XDocument
, and then use XDocument.Validate
. Return false if either the parsing or validation fails. There's some sample code on MSDN which does something pretty similar, and which would be a good starting point.
精彩评论