From scaekenberghe at common-lisp.net Fri Feb 15 14:12:54 2008 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Fri, 15 Feb 2008 15:12:54 +0100 Subject: [s-xml-devel] [PATCH] add ASDF s-xml.test and s-xml.examples systems In-Reply-To: <87hchp42x8.fsf@gismo.pca.it> References: <87hchp42x8.fsf@gismo.pca.it> Message-ID: <9D013859-3231-4F57-87E0-0EA257B80537@common-lisp.net> Luca, Thanks a lot for your excellent patch: everything worked fine for me as well (LispWorks), and I liked what you did (your code just adds functionality without breaking anything, as far as I can see). So I commited it to CVS. I will leave it in CVS only for a little while and if nobody objects I will release it in the tarballs. Keep reminding me though, because there is a good chance that I will forget to do this. Thanks again, Sven PS: the single commit message was: patch contributed by Gismo / Luca Capello: - splitted source code files from test in test and examples directory - added s-xml.test asdf to compile/load the tests - added s-xml.examples to compile/load the examples - modified path references in the test code to use the asdf location On 08 Jan 2008, at 00:43, Luca Capello wrote: > Hi all! > > While Debian bug #450783 [1] has nothing to do with S-XML, it > revives in > me the idea of a complete ASDF S-XML [2]. So, I modified a bit the > patch I provided a long time ago. > > The included patch adds two new ASDF systems: s-xml.test and > s-xml.examples. The former loads all the tests, which should be the > same as the old `(load "/path/to/s-xml/test/all-tests.lisp")', while > the > latter loads all the examples, actually solving Debian bug #450783 > [1]. > > It cleanly compiles on my Debian sid-amd64 with SBCL_1:1.0.12.0-1 and > CLisp_1:2.43-1, with or without SLIME_1:20071202-1. > > Comments, suggestions? > > Thx, bye, > Gismo / Luca > > Footnotes: > [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450783 > [2] http://common-lisp.net/pipermail/s-xml-devel/2006-May/000027.html > > patch_gismo > -20071120.patch.gz>_______________________________________________ > s-xml-devel site list > s-xml-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/s-xml-devel From achambers.home at googlemail.com Fri Feb 22 10:36:21 2008 From: achambers.home at googlemail.com (Andy Chambers) Date: Fri, 22 Feb 2008 10:36:21 +0000 Subject: [s-xml-devel] xpath extras Message-ID: Hi, In the course of using my little xpath contribution, I've come up with a few macros that make life easier. (defmacro ?> (xpath doc) "Execute the specified xpath on doc. If the result is a list of length 1, make it an atom. `(let ((rslt (funcall (sxpath ,xpath) ,doc))) (if (second rslt) rslt (car rslt)))) (defmacro ?let (bindings &body body) "Bind names to xpaths in bindings. Each name then refers to a function that takes as its argument an sxml node and returns the result of executing the specified xpath on that node" (with-gensyms (doc) `(labels ,(loop for (name xpath) in bindings collect `(,name (,doc) (?> ,xpath ,doc))) , at body))) (defmacro with-attrs (bindings node &body body) "Convenience function to make the specified attributes available. Works like with-accessors but for xml attributes" `(let ,(loop for (name attr) in bindings collect `(,name (cadr (?> '(:@ ,attr) ,node)))) , at body)) ;; Note that the second one requires the macro `with-gensyms' (included below for convenience) (defmacro with-gensyms ((&rest names) &body body) `(let ,(loop for n in names collect `(,n (gensym))) , at body)) ;; ;Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: