This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Suggestions for handling XML from Kawa?
- To: Jocelyn Paine <popx at pop3 dot ifs dot org dot uk>
- Subject: Re: Suggestions for handling XML from Kawa?
- From: Per Bothner <per at bothner dot com>
- Date: 07 Aug 2001 13:16:51 -0700
- Cc: kawa at sourceware dot cygnus dot com
- References: <Pine.LNX.4.10.10108070815540.32706-100000@pop3.ifs.org.uk>
Jocelyn Paine <popx@pop3.ifs.org.uk> writes:
> To take my last message (about TreeList) further, has anyone any
> suggestions on the best way of processing parsed XML from Kawa?
I like the idea of using pattern matching combined with
"xml type expressions". XQuery has a type algebra that is rather
expressive. You can combine this with run-time type tests.and
"FLWR"-expressions to do some quite fancy stuff. Even nicer
would be ML-style patterns where you can make variable bindings to
*parts* of a value. A hypothetical Scheme syntax might be:
(match EXPR
((x :: (element-type 'a)) => (something1 x))
((element-type 'b (y :: (element-type 'c))) => (something2 y))
(else => (something3)))
This would evaluate EXPR and first see if it is <a>...</a>.
If so, the variable x is bound to the element, and someting1 is called.
Otherwise, we see is teh value of EXPR matches <a><c>...</c?</b>.
If so, y is bound to the <c>...</c>, and something2 is called.
Otherwise, something3 is called.
I suggest reading about XQueryand related issues at
http://www.w3c.org/XML/Query. There are some interesting ideas there.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/