The title says it all...
Is it possible to get line numbers/positions from a System.Xml.XmlNode
when working with a System.Xml.XmlDocument
?
I want the information so that I can inform the user of where they need to look in their Xml file for specific pieces of information. I've seen similar questions relating to an XmlReader
on SO but nothing that actually answers my question.
I guess I could search the xml file for the OuterXml
of the node that I'm interested in, but that seems hacky, and what if that information appears in the file more than once? There must be a better way?
Update: I'm loading my xml file using:
xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load(filename);