I'm creating XML parser using C#. I need to display all exceptions on the windows form that I am using. However, I can only get one exception at a time.
for example, I'm parsing: test.xml
<xml>
<head>
<title>Book</title>
<head>
<xml>
If you notice there are 2 unclosed tags for head and xml tags. This is part of the c# code:
catch (XmlException f)
{
MessageBox.Show(f.Message);
}
If I run the program, it will only throw an exception to tell that head tag is unclosed.
However, if I just corrected the unclosed tag for head(i.e. /head), then the exception will now only throw regarding xml tag. Is there a way to scan the whole xml file without throwing errors first, at the end of the scan, throw both exceptions to user at the same time?