emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xml-parse-file and text properties


From: JD Smith
Subject: Re: xml-parse-file and text properties
Date: Tue, 25 Jul 2006 09:05:59 -0700
User-agent: Pan/0.14.2.91 (As She Crawled Across the Table)


Just for completeness: Richard checked in the changes below, and they
have the effect of avoiding the unwanted text properties for parsed
files not already loaded in a buffer.

> *** xml.el    06 Feb 2006 07:33:36 -0700      1.53
> --- xml.el    24 Jul 2006 09:40:07 -0700      
> ***************
> *** 161,187 ****
>   ;;;###autoload
>   (defun xml-parse-file (file &optional parse-dtd parse-ns)
>     "Parse the well-formed XML file FILE.
> ! If FILE is already visited, use its buffer and don't kill it.
> ! Returns the top node with all its children.
> ! If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.
> ! If PARSE-NS is non-nil, then QNAMES are expanded."
> !   (let ((keep))
> !     (if (get-file-buffer file)
> !     (progn
> !       (set-buffer (get-file-buffer file))
> !       (setq keep (point)))
> !       (let (auto-mode-alist)                ; no need for xml-mode
> !     (find-file file)))
> ! 
> !     (let ((xml (xml-parse-region (point-min)
> !                              (point-max)
> !                              (current-buffer)
> !                              parse-dtd parse-ns)))
> !       (if keep
> !       (goto-char keep)
> !     (kill-buffer (current-buffer)))
> !       xml)))
> ! 
>   
>   (defvar xml-name-re)
>   (defvar xml-entity-value-re)
> --- 161,182 ----
>   ;;;###autoload
>   (defun xml-parse-file (file &optional parse-dtd parse-ns)
>     "Parse the well-formed XML file FILE.
> ! If FILE is already visited, use its buffer and don't kill it. Returns the
> ! top node with all its children. If PARSE-DTD is non-nil, the DTD is parsed
> ! rather than skipped. If PARSE-NS is non-nil, then QNAMES are expanded."
> !   (if (get-file-buffer file)
> !       (with-current-buffer (get-file-buffer file)
> !     (save-excursion
> !       (xml-parse-region (point-min)
> !                         (point-max)
> !                         (current-buffer)
> !                         parse-dtd parse-ns)))
> !     (with-temp-buffer
> !       (insert-file-contents file)
> !       (xml-parse-region (point-min)
> !                     (point-max)
> !                     (current-buffer)
> !                     parse-dtd parse-ns))))
>   
>   (defvar xml-name-re)
>   (defvar xml-entity-value-re)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]