aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-07-24 18:02:10 +0000
committerRichard M. Stallman2006-07-24 18:02:10 +0000
commit882cb60d1a74b752827f176ef9ec0193fbc8fd29 (patch)
tree32b20b4f2b527a74cbf8e99ffc3ce73c46fcc6dd
parente1eed9a446f77d37232bb435d15c42550fe5d457 (diff)
downloademacs-882cb60d1a74b752827f176ef9ec0193fbc8fd29.tar.gz
emacs-882cb60d1a74b752827f176ef9ec0193fbc8fd29.zip
(xml-parse-file): Clean up, and use with-temp-buffer.
-rw-r--r--lisp/xml.el29
1 files changed, 13 insertions, 16 deletions
diff --git a/lisp/xml.el b/lisp/xml.el
index 2ce3ec7b4f9..ca8f5bdc81b 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -165,22 +165,19 @@ If FILE is already visited, use its buffer and don't kill it.
165Returns the top node with all its children. 165Returns the top node with all its children.
166If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. 166If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.
167If PARSE-NS is non-nil, then QNAMES are expanded." 167If PARSE-NS is non-nil, then QNAMES are expanded."
168 (let ((keep)) 168 (if (get-file-buffer file)
169 (if (get-file-buffer file) 169 (with-current-buffer (get-file-buffer file)
170 (progn 170 (save-excursion
171 (set-buffer (get-file-buffer file)) 171 (xml-parse-region (point-min)
172 (setq keep (point))) 172 (point-max)
173 (let (auto-mode-alist) ; no need for xml-mode 173 (current-buffer)
174 (find-file file))) 174 parse-dtd parse-ns)))
175 175 (with-temp-buffer
176 (let ((xml (xml-parse-region (point-min) 176 (insert-file-contents file)
177 (point-max) 177 (xml-parse-region (point-min)
178 (current-buffer) 178 (point-max)
179 parse-dtd parse-ns))) 179 (current-buffer)
180 (if keep 180 parse-dtd parse-ns))))
181 (goto-char keep)
182 (kill-buffer (current-buffer)))
183 xml)))
184 181
185 182
186(defvar xml-name-re) 183(defvar xml-name-re)