如何获取我的光标在Eclipse中的位置的XML Dom节点? [英] How do I get the XML Dom node of where my cursor is in Eclipse?

查看:266
本文介绍了如何获取我的光标在Eclipse中的位置的XML Dom节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将xml dom节点和xpath映射到我正在构建的Eclipse自定义XML编辑器中的光标所在位置。它是一个textEditor。到目前为止,我正在实施IContentAssistProcessor。

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.

推荐答案

您可以获得中的-to-get-cursor-position-in-a-eclipse-texteditor>光标,您可以实现存储 XML节点的位置,使用 SAX Locator 。对于鼠标事件,您可以扫描文档并找到最佳匹配节点。我不知道这是多么有效,但这是我要开始的地方。

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.

这篇关于如何获取我的光标在Eclipse中的位置的XML Dom节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆