From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wojciech Meyer Newsgroups: gmane.emacs.devel Subject: Re: Problems with xml-parse-string Date: Sat, 25 Sep 2010 01:25:20 +0100 Message-ID: <87bp7mfz4f.fsf@gmail.com> References: <87vd5x7ty2.fsf@stupidchicken.com> <87vd5wo48a.fsf@stupidchicken.com> <8739t03q2g.fsf@stupidchicken.com> <87k4mb2mfu.fsf@stupidchicken.com> <87pqw3nm4y.fsf@stupidchicken.com> <87iq1v0yi2.fsf@stupidchicken.com> <87bp7nvt9j.fsf@stupidchicken.com> <87r5gikcqd.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1285374339 26111 80.91.229.12 (25 Sep 2010 00:25:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 25 Sep 2010 00:25:39 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 25 02:25:38 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OzIa8-0002Ud-OZ for ged-emacs-devel@m.gmane.org; Sat, 25 Sep 2010 02:25:37 +0200 Original-Received: from localhost ([127.0.0.1]:59924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OzIa7-0004VJ-00 for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2010 20:25:35 -0400 Original-Received: from [140.186.70.92] (port=50303 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OzIZz-0004VE-8M for emacs-devel@gnu.org; Fri, 24 Sep 2010 20:25:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OzIZx-000302-TQ for emacs-devel@gnu.org; Fri, 24 Sep 2010 20:25:27 -0400 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:65505) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzIZx-0002zw-P4 for emacs-devel@gnu.org; Fri, 24 Sep 2010 20:25:25 -0400 Original-Received: by wwb24 with SMTP id 24so3669485wwb.30 for ; Fri, 24 Sep 2010 17:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=67BF63x3g6LcH1FLYleQ02mpntQzhLrpfFgtMmkxAw0=; b=QYJt6GnD6T+WKhMLf3Xm02NXyN+T9cKN5lpxqTPO27aTQ6tMDu+XYyP1p6nwOUmL8d 5xMTeSZHROX6mcxT0/sXeYRvhJ1OUMz0jp0obOaFuV7jhuOJ6zxzhhpS0Omv7h5EHAgh 1Hk6I1O1jnHkim8s6QM9GlRjlRyAnSVL6UVTY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=bM+aQOCz0YM5lRUb/rPeJ3ap6q+/T137LNX4xq0kMKQ10h/rOZnUriWUFOITT8DqYD jGeVWj2vDC7qEolL4h6fkkjKaRj6PplFgOOw8xS4G5mnk+BJ1rr3hrJrxdO05KxUuUaI qNrNtHUExPjTy3M97ftt9EJc+D+fc5DvRElew= Original-Received: by 10.227.37.8 with SMTP id v8mr3673891wbd.37.1285374324535; Fri, 24 Sep 2010 17:25:24 -0700 (PDT) Original-Received: from spec-desktop.specuu.com (host86-133-35-46.range86-133.btcentralplus.com [86.133.35.46]) by mx.google.com with ESMTPS id fz1sm2331299wbb.6.2010.09.24.17.25.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 24 Sep 2010 17:25:23 -0700 (PDT) In-Reply-To: <87r5gikcqd.fsf@stupidchicken.com> (Chong Yidong's message of "Fri, 24 Sep 2010 18:17:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:130818 Archived-At: Chong Yidong writes: > If what you're saying is that it might be good to push certain > (currently unspecified) xml-handling functions into the C level, > I agree. Here is a draft for the API in C - some of the functions could be lifted to Elisp (please feel free to drop comments, strip, or add what I've missed): access functions: sxml-node-attributes sxml-node-content sxml-node-children sxml-node-name sxml-node-comment sxml-node-descent selection functions: sxml-node-get-attribute-by-name sxml-node-get-nodes-by-name destructive structure updates: sxml-node-strip-attributes sxml-node-append sxml-node-prepend sxml-node-add-attribute smxl-node-set-or-insert-attributes smxl-node-set-or-insert-nodes sxml-node-sort cloning: sxml-node-clone mapping: sxml-node-mapc (destructive) sxml-node-map collecting data: sxml-node-flatten sxml-node-filter-flatten sxml-node-sparse-tree sxml-node-leafs visiting: (with some extra flags) sxml-node-visit-depth sxml-node-visit-breadth searching: sxml-node-find sxml-node-search various: sxml-strict-sxmlp sxml-no-attributesp sxml-validp sxml->xml the rest would be done via Xpath. Some of the XML specific things are missing (name-spaces, top-level headers, docs, line numbers and etc.). Open question is how to parse directly buffers (skimming through manuals didn't give my any clue how to deal with custom buffers, AFAIU it is not possible). The tricky question is also how do we interface we xpath. Once we've marshaled the tree to Lisp, we would need to either implement Xpath in Elisp (where there is implementation already: http://www.emacswiki.org/emacs/xpath.el ), or marshal back and again. (should be IMHO faster then Xpath in Elisp, despite copying). Thanks, Wojciech