XPath aware XML templates or content assist

丶灬走出姿态 提交于 2019-12-24 07:55:04

问题


I want to create a custom XML editor that can offer templates or content assists based on the current XPath. Creating templates using the extension point org.eclipse.ui.editors.templates makes it available to the entire context type, which is a bit too simple.

When googling I get links to oXygen who can handle this, i.e:

...XPath aware content assistant showing functions and axes (all documented with sections from the W3C specification), variables and parameters as well as name tests for elements and attributes in context.

I am guessing i'll need to use the WTP XML editor?


回答1:


Need to use the WTP XML? Editor? I don't understand what you mean, given the option you've researched. <oXygen/> is fully-functioned XML editor, either standalone or as an Eclipse plugin; it costs a bit of money ($300+) per license, but if you can afford it, go ahead and use it. It's got the XPath support you're looking for.

I've used it before and was very happy with it.




回答2:


You can. When the WTP XML Editor's contributions to the org.eclipse.wst.sse.ui.completionProposal extension point are invoked, they look up the relevant DOM Node and text location and figure out what to propose. There's no artificial limitation on contributing more "computers". You can see how it's done against the DTD of XML Schema grammar using org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer#computeCompletionProposals(CompletionProposalInvocationContext, IProgressMonitor) or from the XML content assist templates that ship in the XML UI plug-in using org.eclipse.wst.xml.ui.internal.contentassist.XMLTemplatesCompletionProposalComputer#computeCompletionProposals(CompletionProposalInvocationContext, IProgressMonitor).



来源:https://stackoverflow.com/questions/4438420/xpath-aware-xml-templates-or-content-assist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!