From: Alain Frisch <alain@frisch.fr>
To: Richard Jones <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] xpath or alternatives
Date: Wed, 30 Sep 2009 16:51:01 +0200 [thread overview]
Message-ID: <4AC37055.70503@frisch.fr> (raw)
In-Reply-To: <20090930140107.GB5126@annexia.org>
Richard Jones wrote:
> let devs = {{ map [xml] with
> | <domain..>[<devices..>[<disk..>[<source dev=(Latin1 & s) ..>_]]]
> | <domain..>[<devices..>[<disk..>[<source file=(Latin1 & s) ..>_]]] -> [s]
> | _ -> [] }} in
The following should work:
let l = {{ [xml] }} in
let l = {{ map l with <domain..>l -> l | _ -> [] }} in
let l = {{ map l with <devices..>l -> l | _ -> [] }} in
let l = {{ map l with <disk..>l -> l | _ -> [] }} in
let l = {{ map l with <source dev=(Latin1 & s) ..>_
| <source file=(Latin1 & s) ..>_-> s
| _ -> [] }} in
...
let () =
let l = {{ [xml] }} in
let l = {{ (((l.(<domain..>_)) / .(<devices..>_)) / .(<disk..>_)) / }} in
let l = {{ map l with <source dev=(Latin1 & s) ..>_
| <source file=(Latin1 & s) ..>_ -> s
| _ -> [] }} in
..
This uses the constructions e/ and e.(t) as described in the manual.
That said, using OCamlDuce for this kind of XML data-extraction seems
just crazy to me.
Cheers,
Alain
next prev parent reply other threads:[~2009-09-30 14:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-28 12:17 Richard Jones
2009-09-28 12:48 ` [Caml-list] " Yaron Minsky
2009-09-28 15:06 ` Till Varoquaux
2009-09-29 23:00 ` Mikkel Fahnøe Jørgensen
2009-09-30 10:16 ` Richard Jones
2009-09-30 10:36 ` Sebastien Mondet
2009-09-30 10:49 ` Mikkel Fahnøe Jørgensen
2009-09-30 11:05 ` Dario Teixeira
2009-09-30 11:57 ` Richard Jones
2009-09-30 12:59 ` Richard Jones
2009-09-30 13:33 ` Till Varoquaux
2009-09-30 14:01 ` Richard Jones
2009-09-30 14:28 ` Till Varoquaux
2009-09-30 14:51 ` Alain Frisch [this message]
2009-09-30 15:09 ` Richard Jones
2009-09-30 15:18 ` Alain Frisch
2009-10-28 2:22 ` Daniel Bünzli
2009-09-30 13:39 ` Stefano Zacchiroli
2009-09-30 14:49 ` Gerd Stolpmann
2009-09-30 15:12 ` Stefano Zacchiroli
2009-09-30 15:22 ` Jordan Schatz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC37055.70503@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@inria.fr \
--cc=rich@annexia.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox