Commit 882cb60d authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(xml-parse-file): Clean up, and use with-temp-buffer.

parent e1eed9a4
...@@ -165,22 +165,19 @@ If FILE is already visited, use its buffer and don't kill it. ...@@ -165,22 +165,19 @@ If FILE is already visited, use its buffer and don't kill it.
Returns the top node with all its children. Returns the top node with all its children.
If PARSE-DTD is non-nil, the DTD is parsed rather than skipped. If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.
If PARSE-NS is non-nil, then QNAMES are expanded." If PARSE-NS is non-nil, then QNAMES are expanded."
(let ((keep)) (if (get-file-buffer file)
(if (get-file-buffer file) (with-current-buffer (get-file-buffer file)
(progn (save-excursion
(set-buffer (get-file-buffer file)) (xml-parse-region (point-min)
(setq keep (point))) (point-max)
(let (auto-mode-alist) ; no need for xml-mode (current-buffer)
(find-file file))) parse-dtd parse-ns)))
(with-temp-buffer
(let ((xml (xml-parse-region (point-min) (insert-file-contents file)
(point-max) (xml-parse-region (point-min)
(current-buffer) (point-max)
parse-dtd parse-ns))) (current-buffer)
(if keep parse-dtd parse-ns))))
(goto-char keep)
(kill-buffer (current-buffer)))
xml)))
(defvar xml-name-re) (defvar xml-name-re)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment