]> git.eshelyaron.com Git - emacs.git/commitdiff
(xml-substitute-special): Move "&" -> "&" last.
authorThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 4 Jan 2003 09:32:17 +0000 (09:32 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 4 Jan 2003 09:32:17 +0000 (09:32 +0000)
lisp/ChangeLog
lisp/xml.el

index 88f20b862d86709ea7dd24a441d6dfd5b1754f9e..b42ef0debdf95ee9fb3bdcbb53b01a24c1dceaa6 100644 (file)
@@ -1,3 +1,7 @@
+2003-01-04  Thien-Thi Nguyen  <ttn@gnu.org>
+
+       * xml.el (xml-substitute-special): Move "&amp;" -> "&" last.
+
 2003-01-04  Kim F. Storm  <storm@cua.dk>
 
        * simple.el (split-line): If present, copy fill-prefix from
@@ -52,7 +56,7 @@
 
 2003-01-02  Markus Rost  <rost@math.ohio-state.edu>
 
-       * cus-edit.el (customize-group, customize-group-other-window): 
+       * cus-edit.el (customize-group, customize-group-other-window):
        Call custom-load-symbol unconditionally.
        (customize-face, customize-face-other-window): Fix format arg.
 
@@ -71,8 +75,8 @@
 
        * scroll-bar.el (toggle-scroll-bar, scroll-bar-mode): Have
        scroll bars correctly default to being on the right for Mac
-       Carbon port 
-       
+       Carbon port
+
 2002-12-29  Nick Roberts  <nick@nick.uklinux.net>
 
        * gdb-ui.el (gdb-delete-display): Rename (gdb-delete-expression).
 2002-12-26  Andre Spiegel  <spiegel@gnu.org>
 
        * vc.el (vc-next-action-on-file): Use t argument to vc-checkout in
-       order to get the latest version on the current branch.  Update 
+       order to get the latest version on the current branch.  Update
        documentation of vc-BACKEND-checkout to explain this.
 
        * vc-rcs.el (vc-rcs-checkout): Handle t argument for REV.
index cd992502535acb3ad7856e72cf243ba930641bc9..9be12d171ecfd5fb7f8635ebbf4c33281a37d42a 100644 (file)
@@ -125,7 +125,7 @@ If PARSE-DTD is non-nil, the DTD is parsed rather than skipped."
          (set-buffer (get-file-buffer file))
          (setq keep (point)))
       (find-file file))
-    
+
     (let ((xml (xml-parse-region (point-min)
                                 (point-max)
                                 (current-buffer)
@@ -247,7 +247,7 @@ Returns one of:
                  (forward-char -1)
                  (let ((string (buffer-substring-no-properties pos (point)))
                        (pos 0))
-                   
+
                    ;; Clean up the string (no newline characters)
                    ;; Not done, since as per XML specifications, the XML processor
                    ;; 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."
       ;; Each attribute must be unique within a given element
       (if (assoc name attlist)
          (error "XML: each attribute must be unique within an element"))
-      
+
       (push (cons name (match-string-no-properties 1)) attlist)
       (goto-char (match-end 0))
       (skip-chars-forward " \t\n")
@@ -336,7 +336,7 @@ The DTD must end before the position END in the current buffer."
   (skip-chars-forward " \t\n")
   (if (looking-at ">")
       (error "XML: invalid DTD (excepting name of the document)"))
-  
+
   ;;  Get the name of the document
   (looking-at "\\sw+")
   (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."
     ;;  External DTDs => don't know how to handle them yet
     (if (looking-at "SYSTEM")
        (error "XML: Don't know how to handle external DTDs"))
-    
+
     (if (not (= (char-after) ?\[))
        (error "XML: Unknown declaration in the DTD"))
 
@@ -365,7 +365,7 @@ The DTD must end before the position END in the current buffer."
        (setq element (intern (match-string-no-properties 1))
              type    (match-string-no-properties 2))
        (setq end-pos (match-end 0))
-       
+
        ;;  Translation of rule [46] of XML specifications
        (cond
         ((string-match "^EMPTY[ \t\n]*$" type)     ;; empty declaration
@@ -383,7 +383,7 @@ The DTD must end before the position END in the current buffer."
        (if (assoc element dtd)
            (error "XML: elements declaration must be unique in a DTD (<%s>)"
                   (symbol-name element)))
-       
+
        ;;  Store the element in the DTD
        (push (list element type) dtd)
        (goto-char end-pos))
@@ -422,7 +422,7 @@ The DTD must end before the position END in the current buffer."
 
     (if (and (stringp elem) (string= elem "#PCDATA"))
        (setq elem 'pcdata))
-    
+
     (cond
      ((string= modifier "+")
       (list '+ elem))
@@ -442,8 +442,6 @@ The DTD must end before the position END in the current buffer."
 
 (defun xml-substitute-special (string)
   "Return STRING, after subsituting special XML sequences."
-  (while (string-match "&amp;" string)
-    (setq string (replace-match "&"  t nil string)))
   (while (string-match "&lt;" string)
     (setq string (replace-match "<"  t nil string)))
   (while (string-match "&gt;" string)
@@ -452,6 +450,9 @@ The DTD must end before the position END in the current buffer."
     (setq string (replace-match "'"  t nil string)))
   (while (string-match "&quot;" string)
     (setq string (replace-match "\"" t nil string)))
+  ;; do this last to avoid aliasing errors
+  (while (string-match "&amp;" string)
+    (setq string (replace-match "&"  t nil string)))
   string)
 
 ;;*******************************************************************
@@ -471,16 +472,16 @@ The first line indented with INDENT-STRING."
   (let ((tree xml)
        attlist)
     (insert indent-string "<" (symbol-name (xml-node-name tree)))
-    
+
     ;;  output the attribute list
     (setq attlist (xml-node-attributes tree))
     (while attlist
       (insert " ")
       (insert (symbol-name (caar attlist)) "=\"" (cdar attlist) "\"")
       (setq attlist (cdr attlist)))
-    
+
     (insert ">")
-    
+
     (setq tree (xml-node-children tree))
 
     ;;  output the children