This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XML and X-expressions


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/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]