aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2003-01-04 09:32:17 +0000
committerThien-Thi Nguyen2003-01-04 09:32:17 +0000
commit524425ae58a1cd1ce81b4785eaec7cbc5dc17120 (patch)
treeaf2ede4ed9ee58183887f9b912ae92b5aa9ff0b1
parentce40a0e52a61bbf515f86dcf191708e7e0223a98 (diff)
downloademacs-524425ae58a1cd1ce81b4785eaec7cbc5dc17120.tar.gz
emacs-524425ae58a1cd1ce81b4785eaec7cbc5dc17120.zip
(xml-substitute-special): Move "&" -> "&" last.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/xml.el27
2 files changed, 22 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 88f20b862d8..b42ef0debdf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12003-01-04 Thien-Thi Nguyen <ttn@gnu.org>
2
3 * xml.el (xml-substitute-special): Move "&amp;" -> "&" last.
4
12003-01-04 Kim F. Storm <storm@cua.dk> 52003-01-04 Kim F. Storm <storm@cua.dk>
2 6
3 * simple.el (split-line): If present, copy fill-prefix from 7 * simple.el (split-line): If present, copy fill-prefix from
@@ -52,7 +56,7 @@
52 56
532003-01-02 Markus Rost <rost@math.ohio-state.edu> 572003-01-02 Markus Rost <rost@math.ohio-state.edu>
54 58
55 * cus-edit.el (customize-group, customize-group-other-window): 59 * cus-edit.el (customize-group, customize-group-other-window):
56 Call custom-load-symbol unconditionally. 60 Call custom-load-symbol unconditionally.
57 (customize-face, customize-face-other-window): Fix format arg. 61 (customize-face, customize-face-other-window): Fix format arg.
58 62
@@ -71,8 +75,8 @@
71 75
72 * scroll-bar.el (toggle-scroll-bar, scroll-bar-mode): Have 76 * scroll-bar.el (toggle-scroll-bar, scroll-bar-mode): Have
73 scroll bars correctly default to being on the right for Mac 77 scroll bars correctly default to being on the right for Mac
74 Carbon port 78 Carbon port
75 79
762002-12-29 Nick Roberts <nick@nick.uklinux.net> 802002-12-29 Nick Roberts <nick@nick.uklinux.net>
77 81
78 * gdb-ui.el (gdb-delete-display): Rename (gdb-delete-expression). 82 * gdb-ui.el (gdb-delete-display): Rename (gdb-delete-expression).
@@ -157,7 +161,7 @@
1572002-12-26 Andre Spiegel <spiegel@gnu.org> 1612002-12-26 Andre Spiegel <spiegel@gnu.org>
158 162
159 * vc.el (vc-next-action-on-file): Use t argument to vc-checkout in 163 * vc.el (vc-next-action-on-file): Use t argument to vc-checkout in
160 order to get the latest version on the current branch. Update 164 order to get the latest version on the current branch. Update
161 documentation of vc-BACKEND-checkout to explain this. 165 documentation of vc-BACKEND-checkout to explain this.
162 166
163 * vc-rcs.el (vc-rcs-checkout): Handle t argument for REV. 167 * vc-rcs.el (vc-rcs-checkout): Handle t argument for REV.
diff --git a/lisp/xml.el b/lisp/xml.el
index cd992502535..9be12d171ec 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -125,7 +125,7 @@ If PARSE-DTD is non-nil, the DTD is parsed rather than skipped."
125 (set-buffer (get-file-buffer file)) 125 (set-buffer (get-file-buffer file))
126 (setq keep (point))) 126 (setq keep (point)))
127 (find-file file)) 127 (find-file file))
128 128
129 (let ((xml (xml-parse-region (point-min) 129 (let ((xml (xml-parse-region (point-min)
130 (point-max) 130 (point-max)
131 (current-buffer) 131 (current-buffer)
@@ -247,7 +247,7 @@ Returns one of:
247 (forward-char -1) 247 (forward-char -1)
248 (let ((string (buffer-substring-no-properties pos (point))) 248 (let ((string (buffer-substring-no-properties pos (point)))
249 (pos 0)) 249 (pos 0))
250 250
251 ;; Clean up the string (no newline characters) 251 ;; Clean up the string (no newline characters)
252 ;; Not done, since as per XML specifications, the XML processor 252 ;; Not done, since as per XML specifications, the XML processor
253 ;; should always pass the whole string to the application. 253 ;; should always pass the whole string to the application.
@@ -295,7 +295,7 @@ Leaves the point on the first non-blank character after the tag."
295 ;; Each attribute must be unique within a given element 295 ;; Each attribute must be unique within a given element
296 (if (assoc name attlist) 296 (if (assoc name attlist)
297 (error "XML: each attribute must be unique within an element")) 297 (error "XML: each attribute must be unique within an element"))
298 298
299 (push (cons name (match-string-no-properties 1)) attlist) 299 (push (cons name (match-string-no-properties 1)) attlist)
300 (goto-char (match-end 0)) 300 (goto-char (match-end 0))
301 (skip-chars-forward " \t\n") 301 (skip-chars-forward " \t\n")
@@ -336,7 +336,7 @@ The DTD must end before the position END in the current buffer."
336 (skip-chars-forward " \t\n") 336 (skip-chars-forward " \t\n")
337 (if (looking-at ">") 337 (if (looking-at ">")
338 (error "XML: invalid DTD (excepting name of the document)")) 338 (error "XML: invalid DTD (excepting name of the document)"))
339 339
340 ;; Get the name of the document 340 ;; Get the name of the document
341 (looking-at "\\sw+") 341 (looking-at "\\sw+")
342 (let ((dtd (list (match-string-no-properties 0) 'dtd)) 342 (let ((dtd (list (match-string-no-properties 0) 'dtd))
@@ -348,7 +348,7 @@ The DTD must end before the position END in the current buffer."
348 ;; External DTDs => don't know how to handle them yet 348 ;; External DTDs => don't know how to handle them yet
349 (if (looking-at "SYSTEM") 349 (if (looking-at "SYSTEM")
350 (error "XML: Don't know how to handle external DTDs")) 350 (error "XML: Don't know how to handle external DTDs"))
351 351
352 (if (not (= (char-after) ?\[)) 352 (if (not (= (char-after) ?\[))
353 (error "XML: Unknown declaration in the DTD")) 353 (error "XML: Unknown declaration in the DTD"))
354 354
@@ -365,7 +365,7 @@ The DTD must end before the position END in the current buffer."
365 (setq element (intern (match-string-no-properties 1)) 365 (setq element (intern (match-string-no-properties 1))
366 type (match-string-no-properties 2)) 366 type (match-string-no-properties 2))
367 (setq end-pos (match-end 0)) 367 (setq end-pos (match-end 0))
368 368
369 ;; Translation of rule [46] of XML specifications 369 ;; Translation of rule [46] of XML specifications
370 (cond 370 (cond
371 ((string-match "^EMPTY[ \t\n]*$" type) ;; empty declaration 371 ((string-match "^EMPTY[ \t\n]*$" type) ;; empty declaration
@@ -383,7 +383,7 @@ The DTD must end before the position END in the current buffer."
383 (if (assoc element dtd) 383 (if (assoc element dtd)
384 (error "XML: elements declaration must be unique in a DTD (<%s>)" 384 (error "XML: elements declaration must be unique in a DTD (<%s>)"
385 (symbol-name element))) 385 (symbol-name element)))
386 386
387 ;; Store the element in the DTD 387 ;; Store the element in the DTD
388 (push (list element type) dtd) 388 (push (list element type) dtd)
389 (goto-char end-pos)) 389 (goto-char end-pos))
@@ -422,7 +422,7 @@ The DTD must end before the position END in the current buffer."
422 422
423 (if (and (stringp elem) (string= elem "#PCDATA")) 423 (if (and (stringp elem) (string= elem "#PCDATA"))
424 (setq elem 'pcdata)) 424 (setq elem 'pcdata))
425 425
426 (cond 426 (cond
427 ((string= modifier "+") 427 ((string= modifier "+")
428 (list '+ elem)) 428 (list '+ elem))
@@ -442,8 +442,6 @@ The DTD must end before the position END in the current buffer."
442 442
443(defun xml-substitute-special (string) 443(defun xml-substitute-special (string)
444 "Return STRING, after subsituting special XML sequences." 444 "Return STRING, after subsituting special XML sequences."
445 (while (string-match "&amp;" string)
446 (setq string (replace-match "&" t nil string)))
447 (while (string-match "&lt;" string) 445 (while (string-match "&lt;" string)
448 (setq string (replace-match "<" t nil string))) 446 (setq string (replace-match "<" t nil string)))
449 (while (string-match "&gt;" string) 447 (while (string-match "&gt;" string)
@@ -452,6 +450,9 @@ The DTD must end before the position END in the current buffer."
452 (setq string (replace-match "'" t nil string))) 450 (setq string (replace-match "'" t nil string)))
453 (while (string-match "&quot;" string) 451 (while (string-match "&quot;" string)
454 (setq string (replace-match "\"" t nil string))) 452 (setq string (replace-match "\"" t nil string)))
453 ;; do this last to avoid aliasing errors
454 (while (string-match "&amp;" string)
455 (setq string (replace-match "&" t nil string)))
455 string) 456 string)
456 457
457;;******************************************************************* 458;;*******************************************************************
@@ -471,16 +472,16 @@ The first line indented with INDENT-STRING."
471 (let ((tree xml) 472 (let ((tree xml)
472 attlist) 473 attlist)
473 (insert indent-string "<" (symbol-name (xml-node-name tree))) 474 (insert indent-string "<" (symbol-name (xml-node-name tree)))
474 475
475 ;; output the attribute list 476 ;; output the attribute list
476 (setq attlist (xml-node-attributes tree)) 477 (setq attlist (xml-node-attributes tree))
477 (while attlist 478 (while attlist
478 (insert " ") 479 (insert " ")
479 (insert (symbol-name (caar attlist)) "=\"" (cdar attlist) "\"") 480 (insert (symbol-name (caar attlist)) "=\"" (cdar attlist) "\"")
480 (setq attlist (cdr attlist))) 481 (setq attlist (cdr attlist)))
481 482
482 (insert ">") 483 (insert ">")
483 484
484 (setq tree (xml-node-children tree)) 485 (setq tree (xml-node-children tree))
485 486
486 ;; output the children 487 ;; output the children