Added function that copies xpath-like path in XML document.
--- a/.emacs-my Sun Dec 03 10:55:56 2017 +0200
+++ b/.emacs-my Sun Dec 03 10:57:05 2017 +0200
@@ -3493,6 +3493,27 @@
(my--eval-after-load nxml-mode
(define-key nxml-mode-map [C-return] 'nxml-complete))
+(defun my-nxml-where (&optional prefix)
+ "Display the hierarchy of XML elements the point is on as a path."
+ (interactive "P")
+ (let (path)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (while (and (< (point-min) (point))
+ (condition-case nil
+ (progn
+ (nxml-backward-up-element)
+ t)
+ (error nil)))
+ (setq path (cons (xmltok-start-tag-local-name) path)))
+ (setq path (mapconcat 'identity path "/"))
+ (when prefix
+ (kill-new path))
+ (if (called-interactively-p t)
+ (message "%s" path)
+ path)))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(message "relax ng, rng")