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

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

问题描述

如何在我正在构建的 Eclipse 自定义 XML 编辑器中获取指向光标所在位置的 xml dom 节点和 xpath.它是一个文本编辑器.到目前为止,我正在实施 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.

推荐答案

可以获取文本编辑器中的光标,您可以实现一个存储 XML 节点的位置 使用 SAX 定位器.对于鼠标事件,您可以扫描文档并找到最佳匹配节点.我不确定它的性能如何,但这是我要开始的地方.

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天全站免登陆