问题
How do I get the xml dom node and xpath to where my cursor is in an Eclipse custom XML editor that I am building. It is a textEditor. I am implementing IContentAssistProcessor thus far.
回答1:
You can get the position of the cursor in the text editor and you can implement an XML reader that stores the locations of the XML nodes using the SAX Locator. For a mouse event, you could then scan the document and find the best matching node. I am not sure how performant this is but this is where I would start.
来源:https://stackoverflow.com/questions/44742478/how-do-i-get-the-xml-dom-node-of-where-my-cursor-is-in-eclipse