From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: XML editing wishlist (was: Saving markup formats) Date: Sun, 17 Jun 2007 17:30:40 -0700 Message-ID: References: <87sl8qnrme.fsf@kanga.tapsellferrier.co.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1182126767 7467 80.91.229.12 (18 Jun 2007 00:32:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2007 00:32:47 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 18 02:32:46 2007 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.50) id 1I05Ai-0004Vh-SB for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2007 02:32:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I05Ai-0004qY-2t for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2007 20:32:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I05Ad-0004kn-FZ for emacs-devel@gnu.org; Sun, 17 Jun 2007 20:32:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I05Ac-0004jt-W5 for emacs-devel@gnu.org; Sun, 17 Jun 2007 20:32:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I05Ac-0004jL-Lp for emacs-devel@gnu.org; Sun, 17 Jun 2007 20:32:38 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I05Ac-0001EB-50 for emacs-devel@gnu.org; Sun, 17 Jun 2007 20:32:38 -0400 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l5I0WZ7d000951 for ; Sun, 17 Jun 2007 19:32:35 -0500 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l5HNuAbA022023 for ; Sun, 17 Jun 2007 18:32:34 -0600 Original-Received: from dhcp-amer-csvpn-gw1-141-144-64-234.vpn.oracle.com by acsmt351.oracle.com with ESMTP id 2934802451182126658; Sun, 17 Jun 2007 17:30:58 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <87sl8qnrme.fsf@kanga.tapsellferrier.co.uk> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-detected-kernel: Linux 2.4-2.6 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:73199 Archived-At: Some thoughts on Emacs support for editing XML... I use nxml mode now when I edit XML with Emacs 22. I use SGML mode for that when I use Emacs 20 (which is still most of the time ;-)). I'm not very familiar with either mode, sad to say. So please ignore or forgive (and correct) any misconceptions about them that I might demonstrate. I edit XML code quite often, in spite of not having taken the time to check out nxml mode well. Sometimes the XML I edit is within SQL or PL/SQL code, as an argument to a SQL function. Similarly, I use XQuery and XPath expressions quite often - likewise, within calls to SQL functions such as XMLQuery and XMLTable. I really should try a multi-mode approach such as mmm or mumamo, no doubt, but I haven't had time to do that yet either - I just use SQL mode. I know that there is an XQuery Emacs mode that exists. I downloaded it, but I haven't yet tried it. I see zero commentary in the file and I haven't found any Info file for it. I often use XML Schema - that is, most of the XML I use is XML Schema-based. I do not use any other type of schema for XML, except sometimes DTDs. In particular, I don't use Relax NG. In the database world, it's all about XML Schema and XQuery - and becoming more so (no flames, please). I would love to see a really handy XML editing mode. I don't claim it doesn't exist, but I haven't yet noticed some things I'd like to see. `C-h m' in nXML mode gives only a cursory description, the XML menu-bar menu seems quite sparse, there are no contextual pop-up menus (that I have noticed), and the nXML Info manual (which I have only skimmed) seems also quite skimpy. In short, where's the beef? ;-) XML is huge. It is an ugly cousin of Lisp, in some ways. We really should have something more to offer the _many_ different kinds of XML users, IMO. Again, maybe we do, and I'm just unaware of it. FWIW, I also use Framemaker, for work, and it is a surprisingly good WYSIWYG round-trip editor for XML documents. It has great search and replace for XML elements and attributes, and good visualization and manipulation of XML structure (it's easy to change the structure interactively and not get lost in what you're doing). It also has a good validation interface, but it is limited to DTDs (or to simple XML Schemas that are limited to what DTDs can do). Some things I'd like to see in Emacs for XML (they might be there, but I haven't noticed): 1. Double-click the mouse on `<' or `>' to pick up a complete sexp, just as in Lisp. Or, better, double-click to pick up a complete tag and triple-click to pick up the complete element. Currently, as soon as there is any whitespace (e.g. there is an attribute), the complete tag is not selected. Double-click, then right-click to extend to the next element boundary (or something more significant than just a word). Other mouse selection possibilities could also be useful. The mouse now seems almost useless for XML. 2. XPath navigation. 3. XQuery navigation. 4. XML Schema support. 5. XML-specific search capabilities, even unrelated to XPath and XQuery: search (and replace) for elements with certain attribute values etc. - at least as good as what Framemaker has. You can imagine different things for #2 and #3, from adding, deleting, and selecting nodes to constructing more XML data using XQuery. Really, the possibilities are limitless. I'd like the editor to let me use XQuery and XPath to edit XML. I'd also like editor support for XQuery code itself; that is, for editing XQuery and XPath expressions. Neither is XML (unlike XSLT). XPath and XQuery (which includes XPath) are the natural matching languages for XML. Regular expressions are completely general; they cannot take advantage of anything defined in the XML language. I've thought about adding something for #2 and #3 to Icicles, and I might yet do so when I get some time. The idea would be to type an XPath or XQuery expression as minibuffer input and have all of the matching nodes become completion candidates (yes, whole nodes). More precisely, the result of an XQuery expression is a sequence of items, which can be atoms or nodes. The sequence would be used as the completion candidates set. Different commands would do different things with those candidates. I would use an Icicles search command to navigate among them. I would use another command to select one or more, or transform one or more. And so on. IOW, use XML-aware matching instead of regexp matching. For that, I would add a different kind of completion to Icicles, in addition to prefix completion and apropos (regexp) completion. But I would need something to parse the XML and come up with the set of matching candidates for the current input. I have no time to work on that parsing code myself - perhaps such code exists and I could tap into it; I don't know. I've had this project in the back of my head almost since I started working on Icicles. Put it this way - soon after I had the idea of adding regexp completion, I thought of adding XPath or XQuery completion. After all, the basic infrastructure of Icicles can use any kind of matching. The hard part (now) is doing the XQuery/XPath matching. Anyway, just throwing this out as food for thought, in case someone finds it interesting. I've kept it to myself long enough, without yet finding the time to do anything about it. Actually, I did mention it on some XML lists long ago, asking for some info about existing Emacs packages, but I never got any reply. IIUC, the current limited form of Emacs XML support is both a pain and an opportunity to do something better.