From: David Engster Date: Tue, 24 Jan 2017 21:47:53 +0000 (+0100) Subject: xml: Fix parsing of default namespace with quoted names X-Git-Tag: emacs-26.0.90~870^2~75 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aea6701839357eb139e29056274996c70f42b860;p=emacs.git xml: Fix parsing of default namespace with quoted names * lisp/xml.el (xml-parse-attlist): Properly extract namespace when parsing is done with quoted symbol names (bug#23440). * test/lisp/xml-tests.el (xml-parse-test--default-namespace-qnames) (xml-parse-test-default-namespace-qnames): Test for the above. --- diff --git a/lisp/xml.el b/lisp/xml.el index cd801be3083..be2ac96f264 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -646,8 +646,10 @@ surpassed `xml-entity-expansion-limit'")))) (defun xml-parse-attlist (&optional xml-ns) "Return the attribute-list after point. Leave point at the first non-blank character after the tag." - (let ((attlist ()) - end-pos name) + (let* ((attlist ()) + (symbol-qnames (eq (car-safe xml-ns) 'symbol-qnames)) + (xml-ns (if symbol-qnames (cdr xml-ns) xml-ns)) + end-pos name) (skip-syntax-forward " ") (while (looking-at (eval-when-compile (concat "\\(" xml-name-re "\\)\\s-*=\\s-*"))) diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el index 0f2182a6a75..d0da2094db7 100644 --- a/test/lisp/xml-tests.el +++ b/test/lisp/xml-tests.el @@ -134,6 +134,21 @@ Parser is called with and without 'symbol-qnames argument.") (append xml-default-ns '(("F" . "FOOBAR:")))))))))) +;; Test bug #23440 (proper expansion of default namespace) +; Test data for default namespace +(defvar xml-parse-test--default-namespace-qnames + (cons "" + '((myns:something + ((("http://www.w3.org/2000/xmlns/" . "") + . "myns:")) + (myns:whatever nil))))) + +(ert-deftest xml-parse-test-default-namespace-qnames () + (with-temp-buffer + (insert (car xml-parse-test--default-namespace-qnames)) + (should (equal (cdr xml-parse-test--default-namespace-qnames) + (xml-parse-region nil nil nil nil 'symbol-qnames))))) + ;; Local Variables: ;; no-byte-compile: t ;; End: