XmlSyntaxException vs XmlException in .Net

93 Views Asked by At

Which is prefer in what case in the concept of reuse predefined exception classes?

For example I was parsing a document using XmlReader and faced with inconsistent close tag:

<?xml version=""1.0"" encoding=""UTF-8""?>
<element1>
    <element2>
        some content
    </element3>
</element1>

What to throw?

It should be noted that this two exceptions do not inherit one another so should be caught separately.

0

There are 0 best solutions below