This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: XML and X-expressions
- From: Per Bothner <per at bothner dot com>
- To: Dominique Boucher <dboucher at nuecho dot com>
- Cc: Kawa List <kawa at sources dot redhat dot com>
- Date: Thu, 25 Sep 2003 09:16:42 -0700
- Subject: Re: XML and X-expressions
- References: <001601c3836a$fce42cd0$6400a8c0@Forman>
Dominique Boucher wrote:
To do this, I need to traverse XML documents in Scheme and match
patterns against the XML elements. Suppose I read an XML file with
parse-xml-from-url. The result is an XML tree as if created with
make-element and make-attributes. Given such a tree, how do I extract
the element tag name? the value of a specific attribute? The child
elements? Do I have to define classes implementing the Consumer
interface in order to do that?
You probably want to look at Qexo (http://www.gnu.org/software/qexo/),
which is an XQuery implementation that is part of Kawa. Even if you're
not interested in XQuery per se (presumably you prefer Scheme syntax),
it is a useful source of ideas, both at the language level, and in
terms of theKawa implementation.
There is a 'children' function to extract child nodes.
To get just child elements you could use the ChildAxis class.
BTW - there is a very incomplete XSLT implementation in Kawa.
--
--Per Bothner
per@bothner.com http://per.bothner.com/