This project is read-only.

get the current XML tag parent

Jun 9, 2009 at 4:17 PM

Hi there,

I am using scintillaNet to edit XMLfiles, I want to know if it is possible for me to get the current XML tag parent using the Expand margin ??


Jun 10, 2009 at 8:13 AM

I'm don't know what exactly you want to do, but I wouldn't use ScintillaNET for the XML Modifications or something similar.

Instead use XmlDocument for the XML Operations and the current Position (Scintilla.Caret.Position) in Scintilla about getting the current XML Node.

Then select the Node in the XmlDocument and do what you have to do ;-)

Jun 10, 2009 at 3:40 PM

Yeah I wouldn't rely on the expansion indicators to get the XML parent. They aren't always 100% accurate. Parsing the XML using .NET may work depending on what you're doing. However if you're running this often and/or working with large documents this method becomes impractical. Also if the user is editing XML there's a good chance the document won't be well formed and XML parsing will fail.

Can you explain a little more about what you want to accomplish?

Jun 10, 2009 at 3:44 PM

Notepad++ has automatic tag matching/highlighting, we can see how they do it.

Jun 10, 2009 at 3:55 PM

Looking through xmlMatchedTagsHighlighter.cpp in the Notepad++ source they determine which tag they're on (if any) then use Search to find it's match. The entire process is pretty involved however.