[plt-scheme] Re: getting data out of xexpr's (xml)
My two cents on XML matching:
I tend to find match and plt-match to be a little restrictive for XML
pattern matching. The classic example of this is attributes on
elements, which can arrive in any order. For example:
'(a (@ [href "http://www.example.com"]
[target "_new"])
"Example web site")
is equivalent to:
'(a (@ [target "_new"]
[href "http://www.example.com"])
"Example web site")
but you have to match against it with two clauses like this:
(match link
[`(a (@ [target ,target] [href ,href]) ,text)
...]
[`(a (@ [href ,href] [target ,target]) ,text)
...])
or using nested matches, one for the elements and one for the
attributes.
Perhaps there's an order-independent list pattern in plt-match that I
don't know about? If not, the XML matching library is probably better
for this kind of thing. However, xml-match it has its own limitations
too (I can't remember these off the top of my head: I just remember
that writing delicious.plt wasn't as straightforward as I might have
hoped).
I haven't tried SXPath yet.
Cheers,
-- Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080108/d58bf927/attachment.html>