[plt-scheme] Re: getting data out of xexpr's (xml)

From: Stephen De Gabrielle (stephen at degabrielle.name)
Date: Tue Jan 8 09:50:03 EST 2008

Yeah, thanks for raising that.

I think I've seen this in the test cases; I think order-independent list
pattern in plt-match is
    (list-no-order pat ... lvp)       Match arguments in a list in any
order
, but I haven't tried it yet.

I'm using Matt's example as a base at the moment, and just hoping my data is
ordered consistently, not because the schema/dtd requires it, but because it
is machine generated. (probably too much of an assumption)

By xml-match so you mean sxml-match? if not please tell me, as I have missed
it.

Both sxml-match and SXPath seem to cover all the bases, but I am trying them
one at a time.

Cheers,

Stephen


On Jan 8, 2008 2:22 PM, Dave Gurnell <d.j.gurnell at gmail.com> wrote:

> 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
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>


-- 
Cheers,

Stephen



--
Stephen De Gabrielle
s.degabrielle at ucl.ac.uk
Telephone +44 (0)20 7679 5242 (x45242)
Mobile                  079 851 890 45
http://www.uclic.ucl.ac.uk/annb/MaSI.html
University College London Interaction Centre
Remax House - 31/32 Alfred Place
London - WC1E 7DP

"There's an old story about the person who wished his computer were as easy
to use as his telephone.  That wish has come true, since I no longer know
how to use my telephone. " -- Bjarne Stroustrup
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080108/8f5209c3/attachment.html>

Posted on the users mailing list.