* xml.el doesn't handle empty attributes correctly
@ 2005-09-24 19:10 Rob Austein
0 siblings, 0 replies; 2+ messages in thread
From: Rob Austein @ 2005-09-24 19:10 UTC (permalink / 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* xml.el doesn't handle empty attributes correctly
[not found] <E1EJga6-0002OE-6V@fencepost.gnu.org>
@ 2005-09-26 3:15 ` Mark A. Hershberger
0 siblings, 0 replies; 2+ messages in thread
From: Mark A. Hershberger @ 2005-09-26 3:15 UTC (permalink / raw)
Cc: bug-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 550 bytes --]
> Problem:
>
> XML attribute values can be empty, but xml.el doesn't allow that.
> The regexps in xml.el are wrong.
This has been fixed in CVS for some time.
A few other problems have been fixed as well. You can get the CVS
version from http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/xml.el
I'm not sure if this will work with non-CVS emacs, though.
--
http://mah.everybody.org/weblog/
GPG Fingerprint: 7E15 362D A32C DFAB E4D2 B37A 735E F10A 2DFC BFF5
Someone will always sell you for 30 pieces of silver.
-- Andrei Rublev
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-26 3:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-24 19:10 xml.el doesn't handle empty attributes correctly Rob Austein
[not found] <E1EJga6-0002OE-6V@fencepost.gnu.org>
2005-09-26 3:15 ` Mark A. Hershberger
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.