From: Alex Harsanyi <harsanyi@mac.com>
To: 10405@debbugs.gnu.org
Subject: bug#10405: 24.0.92; XML parser -- problem handling comments
Date: Fri, 30 Dec 2011 08:44:13 +0800 [thread overview]
Message-ID: <A9CE00E5-C4F7-432B-97E0-BA016DA642FB@mac.com> (raw)
There seems to be a bug in `xml-parse-tag' when handling comments. To
reproduce it, create a buffer containing the following text on a single line:
<!-- hello --><outer><inner></inner></outer>
Trying to parse this using
M-: (xml-parse-region (point-min) (point-max))
will return:
((inner nil))
instead of:
((outer nil (inner nil)))
Inserting a space or newline after the end comment tag (-->) seems to
avoid this bug.
The patch below fixes the problem, but I'm not sure if it is the correct
fix (I just copied the code from the part that handles processing
instructions, that start with <?):
=== modified file 'lisp/xml.el'
*** lisp/xml.el 2011-11-20 03:48:53 +0000
--- lisp/xml.el 2011-12-30 00:39:42 +0000
***************
*** 421,427 ****
;; skip comments
((looking-at "<!--")
(search-forward "-->")
! nil)
;; end tag
((looking-at "</")
'())
--- 421,428 ----
;; skip comments
((looking-at "<!--")
(search-forward "-->")
! (skip-syntax-forward " ")
! (xml-parse-tag parse-dtd xml-ns))
;; end tag
((looking-at "</")
'())
In GNU Emacs 24.0.92.1 (x86_64-apple-darwin10.8.0, NS apple-appkit-1038.36)
of 2011-12-30 on karinji-2.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure '--with-ns''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_AU.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Fundamental
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
C-x b * x m l * <return> < ! - - SPC h e l l o SPC
- - > < o u t e r > < i n n e r > < / i n n e r > /
<backspace> < / o u t e r > <return> <up> s-: s-( s-:
s-: M-: e <backspace> x <backspace> ( x m o <backspace>
l - p a s e <backspace> <backspace> r s e - r e g i
o n SPC ( p o i n t - m i n ) SPC ( p o i n t ) <backspace>
- m a x ) ) <return> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <return> M-: <up> <return>
<backspace> SPC M-: <up> <return> <right> <left> <backspace>
M-: <down> <up> <return> <left> <right> <right> <right>
<right> <right> <right> <right> <right> M-x r e p o
<tab> r t <tab> <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Starting new Ispell process [default] ...
Spell-checking *xml* using aspell with default dictionary...done
Spell-checking *xml* using aspell with default dictionary...done
Spell-checking *xml* using aspell with default dictionary...done
((inner nil))
((outer nil (inner nil))) [2 times]
goto-history-element: End of history; no default available
((inner nil))
Making completion list...
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug help-mode easymenu view xml regexp-opt ispell time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind ns
multi-tty emacs)
next reply other threads:[~2011-12-30 0:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-30 0:44 Alex Harsanyi [this message]
2012-01-09 15:47 ` bug#10405: 24.0.92; XML parser -- problem handling comments Michael Albinus
2012-01-27 8:47 ` Chong Yidong
2012-01-27 14:25 ` Mark A. Hershberger
2012-02-08 8:22 ` Michael Albinus
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A9CE00E5-C4F7-432B-97E0-BA016DA642FB@mac.com \
--to=harsanyi@mac.com \
--cc=10405@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).