如何获取 Eclipse 中光标所在位置的 XML Dom 节点?

2023-08-20Java开发问题
3

本文介绍了如何获取 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 节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

Eclipse 在尝试启动 Android 应用程序时卡住了
Eclipse gets stuck when trying to launch Android app(Eclipse 在尝试启动 Android 应用程序时卡住了)...
2024-08-25 Java开发问题
14

Eclipse:无法初始化监视器线程:无法建立环回连接
Eclipse: Failed to initialize Monitor Thread: Unable to establish loopback connection(Eclipse:无法初始化监视器线程:无法建立环回连接)...
2024-08-25 Java开发问题
4

Eclipse-找不到JDK
Eclipse- JDK not found(Eclipse-找不到JDK)...
2024-08-25 Java开发问题
6

如何让 Eclipse 在 Windows 7 任务栏中表现良好?
How to make Eclipse behave well in the Windows 7 taskbar?(如何让 Eclipse 在 Windows 7 任务栏中表现良好?)...
2024-08-25 Java开发问题
9

本机方法中的致命错误:JDWP 未初始化传输,jvmtiError=AGENT_ERROR_TRANSPORT_INIT
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)(本机方法中的致命错误:JDWP 未初始化传输,jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197))...
2024-08-25 Java开发问题
107