This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Proposed feature: in the XML editor, enable the user to automatically construct an XPath expression to an element or attribute. This could work by adding an item to the right click menu on the editor. When selecting this item, it will generate an XPath expression and place it on the clipboard.
Do you have an implementation suggestion for it? I also thought about it but there is an indefinite number of possible XPathes which would match on the same element/ attribute. Example: <root> <element1 /> <element2 /> <!--- this is assumed to be the selected one --> <element2 /> </root> Some possibilities: /root/*[2] /root/element2[1] //element2[1]
Indeed, there are multiple expressions leading to the same result. I think the most restrictive expression would be best. In your example, it would be /root/element2[1]. If schema information can be used: if the multiplicity of element2 is 1, the [1] can be dropped. If no schema info can be used, the absence of a duplicate element2 can be used to drop the [1] index. I don't expect the expression generator to be perfect, but it'll likely be good enough in 90% of the cases.
Not sure who is spanda. Assigned to myself.