I have an xml string ,While de serializing this xml I got an error like 'There is an error in XML document (498, 31)' .How can I get the xml node at this position in c#,so that I can send it to user that there is an issue in this particular node.
using (TextReader reader = new StringReader(xml))
{
try
{
tempClass = (T)new XmlSerializer(typeof(T)).Deserialize(reader);
}
catch (InvalidOperationException ex)
{
//Here we need to show the node in which the error occurred
}
}
Here in catch I got the message like 'There is an error in XML document (498, 31)'.I want to throw a custom error message to the user that, 'in this particular 'node' there is an issue' Any help or ideas on the subject would be greatly appreciated.