From: Rob Austein <sra@hactrn.net>
Subject: xml.el doesn't handle empty attributes correctly
Date: Sat, 24 Sep 2005 15:10:18 -0400 [thread overview]
Message-ID: <20050924191018.82F3441AB@thrintun.hactrn.net> (raw)
Problem:
XML attribute values can be empty, but xml.el doesn't allow that.
The regexps in xml.el are wrong.
Example:
bash$ cat xml-bug.el
(message "Emacs version: %s" emacs-version)
(defun test ()
(prin1-to-string
(let ((buf (get-buffer-create "xml-bug")))
(princ "<foo bar=''/>" buf)
(set-buffer buf)
(message "Test buffer: %s" (buffer-string))
(unwind-protect
(let (cc)
(condition-case cc
(xml-parse-region (point-min) (point-max))
(error cc)))
(kill-buffer buf)))))
(load "/usr/local/share/emacs/21.3/lisp/xml.el")
(message "Parse result: %s" (test))
(load "/tmp/xml.el")
(message "Parse result: %s" (test))
bash$ emacs -batch -l xml-bug.el
Emacs version: 21.3.1
Loading /usr/local/share/emacs/21.3/lisp/xml.el (source)...
Test buffer: <foo bar=''/>
Parse result: (error "XML: Attribute values must be given between quotes")
Loading /tmp/xml.el (source)...
Test buffer: <foo bar=''/>
Parse result: ((foo ((bar . "")) ""))
Patch:
--- /usr/local/share/emacs/21.3/lisp/xml.el Thu Oct 18 20:19:51 2001
+++ /tmp/xml.el Sat Sep 24 18:39:53 2005
@@ -289,8 +289,8 @@
;; Do we have a string between quotes (or double-quotes),
;; or a simple word ?
- (unless (looking-at "\"\\([^\"]+\\)\"")
- (unless (looking-at "'\\([^']+\\)'")
+ (unless (looking-at "\"\\([^\"]*\\)\"")
+ (unless (looking-at "'\\([^']*\\)'")
(error "XML: Attribute values must be given between quotes")))
;; Each attribute must be unique within a given element
--Rob
next reply other threads:[~2005-09-24 19:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-24 19:10 Rob Austein [this message]
[not found] <E1EJga6-0002OE-6V@fencepost.gnu.org>
2005-09-26 3:15 ` xml.el doesn't handle empty attributes correctly Mark A. Hershberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050924191018.82F3441AB@thrintun.hactrn.net \
--to=sra@hactrn.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.