+2003-01-04 Thien-Thi Nguyen <ttn@gnu.org>
+
+ * xml.el (xml-substitute-special): Move "&" -> "&" last.
+
2003-01-04 Kim F. Storm <storm@cua.dk>
* simple.el (split-line): If present, copy fill-prefix from
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.
* 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.
(set-buffer (get-file-buffer file))
(setq keep (point)))
(find-file file))
-
+
(let ((xml (xml-parse-region (point-min)
(point-max)
(current-buffer)
(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.
;; 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")
(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))
;; 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"))
(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
(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))
(if (and (stringp elem) (string= elem "#PCDATA"))
(setq elem 'pcdata))
-
+
(cond
((string= modifier "+")
(list '+ elem))
(defun xml-substitute-special (string)
"Return STRING, after subsituting special XML sequences."
- (while (string-match "&" string)
- (setq string (replace-match "&" t nil string)))
(while (string-match "<" string)
(setq string (replace-match "<" t nil string)))
(while (string-match ">" string)
(setq string (replace-match "'" t nil string)))
(while (string-match """ string)
(setq string (replace-match "\"" t nil string)))
+ ;; do this last to avoid aliasing errors
+ (while (string-match "&" string)
+ (setq string (replace-match "&" t nil string)))
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