comparison lisp/xml.el @ 109288:e24d55cee016

* xml.el (xml-parse-region): Avoid infloop (Bug#5281).
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 30 Jun 2010 16:34:06 -0400
parents 1d1d5d9bd884
children 376148b31b5e
comparison
equal deleted inserted replaced
109287:a18863f338c2 109288:e24d55cee016
319 (while (not (eobp)) 319 (while (not (eobp))
320 (if (search-forward "<" nil t) 320 (if (search-forward "<" nil t)
321 (progn 321 (progn
322 (forward-char -1) 322 (forward-char -1)
323 (setq result (xml-parse-tag parse-dtd parse-ns)) 323 (setq result (xml-parse-tag parse-dtd parse-ns))
324 (if (and xml result (not xml-sub-parser)) 324 (cond
325 ;; translation of rule [1] of XML specifications 325 ((null result)
326 (error "XML: (Not Well-Formed) Only one root tag allowed") 326 ;; Not looking at an xml start tag.
327 (cond 327 (forward-char 1))
328 ((null result)) 328 ((and xml (not xml-sub-parser))
329 ((and (listp (car result)) 329 ;; Translation of rule [1] of XML specifications
330 parse-dtd) 330 (error "XML: (Not Well-Formed) Only one root tag allowed"))
331 (setq dtd (car result)) 331 ((and (listp (car result))
332 (if (cdr result) ; possible leading comment 332 parse-dtd)
333 (add-to-list 'xml (cdr result)))) 333 (setq dtd (car result))
334 (t 334 (if (cdr result) ; possible leading comment
335 (add-to-list 'xml result))))) 335 (add-to-list 'xml (cdr result))))
336 (t
337 (add-to-list 'xml result))))
336 (goto-char (point-max)))) 338 (goto-char (point-max))))
337 (if parse-dtd 339 (if parse-dtd
338 (cons dtd (nreverse xml)) 340 (cons dtd (nreverse xml))
339 (nreverse xml))))))) 341 (nreverse xml)))))))
340 342