1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-04 11:40:22 +00:00

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.
This commit is contained in:
David Engster 2017-01-24 22:47:53 +01:00
parent 267c98ae48
commit aea6701839
2 changed files with 19 additions and 2 deletions

View File

@ -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-*")))

View File

@ -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 "<something xmlns=\"myns:\"><whatever></whatever></something>"
'((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: