If you start to parse the whole infoset to see if it is all valid xml, then
you may as well LoadXML as that what it does anyway. If you want a quick
check/guess, test to see if first char of string is "<". If not, you know
it is not xml. You don't know it is valid xml either, but the load will
tell you that. You may want to Trim() the string first just to remove any
leading or trailing spaces and test for Empty first, then for leading "<"
char.
--
William Stacey [MVP]
"cloudx" <cl****@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
hi there, in VB LoadXML(str) returns true or false so that you can do
different coding when the str is XML or not, but in C# LoadXML doesn't
have
return but only throw exception if str is not XML document. How would I do
if
I want to do my own code if str is not an XML? thanks!