I am writing an XML editor and I want to display syntax errors in the user interface. Since my code editor is very limited to a specific problem domain and audience, I want to rewrite some XMLException messages so that they are more meaningful to users. For example, an exception message like this:
'"' - unexpected token. expected token is equal to '='. Line 30, position 35
.. very technical and not very informative for my audience. Instead, I would like to rewrite it and other messages to something else. For completeness, this means that I need to create a dictionary of existing messages mapped to a new message that I would like to display instead. To do this, I need a list of all the possible messages that XMLException may contain.
Is there such a list somewhere? Or can I find out possible messages through object verification in C #?
Edit: in particular, I use XmlDocument.LoadXml to parse a string in an XmlDocument, and this method throws an XmlException when there are syntax errors. Therefore, in particular, my question is where can I find the list of messages applied to XmlException by XmlDocument.LoadXml. A discussion of what could potentially be a limitless change to the actual lines in the Message XmlException property is controversial.
Edit 2: In particular, I am not seeking advice on whether I should try to do this; I'm just looking for any tips to get various messages. Ben's answer is a step in the right direction. Does anyone know differently?
Rahul source share