How to get location of an XmlElement or XElement?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I am writing a GUI to edit a XML document. There are a few custom validation rules, which, if violated, will spit out error messages. I want to list all the error messages below the XML content which is hosted in a
TextBox , just like Visual Studio lists compiling errors below C# source code, and, when double-clicking the error message, I want the corresponding XML element to be highlighted in the
TextBox , just like what Visual Studio does.
This means that
<ol>
Each error message should be linked to the corresponding XmlElement
(or XElement ) - this is fairly easy; From each XmlElement , I should be able to find out its text location in the
XmlDocument (i.e. the TextBox ), so that I can call the
TextBox s Select method to highlight the element. How can I do that?
</ol>
Thank you in advance!

View the full article
 
Back
Top