bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10405: 24.0.92; XML parser -- problem handling comments


From: Alex Harsanyi
Subject: bug#10405: 24.0.92; XML parser -- problem handling comments
Date: Fri, 30 Dec 2011 08:44:13 +0800

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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]