From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: xml-parse-file and text properties Date: Thu, 20 Jul 2006 17:46:31 -0400 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1153432059 2224 80.91.229.2 (20 Jul 2006 21:47:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Jul 2006 21:47:39 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 20 23:47:38 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G3gMm-0002id-8O for ged-emacs-devel@m.gmane.org; Thu, 20 Jul 2006 23:47:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3gMl-0001hy-ON for ged-emacs-devel@m.gmane.org; Thu, 20 Jul 2006 17:47:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G3gLo-0001Ds-W2 for emacs-devel@gnu.org; Thu, 20 Jul 2006 17:46:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G3gLo-0001DD-Ho for emacs-devel@gnu.org; Thu, 20 Jul 2006 17:46:32 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3gLo-0001D0-8f for emacs-devel@gnu.org; Thu, 20 Jul 2006 17:46:32 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G3gM4-0000hp-VZ for emacs-devel@gnu.org; Thu, 20 Jul 2006 17:46:49 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1G3gLn-00007r-Bp; Thu, 20 Jul 2006 17:46:31 -0400 Original-To: JD Smith In-reply-to: (message from JD Smith on Tue, 18 Jul 2006 14:35:11 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:57397 Archived-At: By the way, it looks like the function xml-parse-file would be much cleaner if written like this. Does this work? (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))))