From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 57340BC37 for ; Wed, 30 Sep 2009 01:00:17 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlMCANctwkrRVdvfkGdsb2JhbACRXohgPwEBAQEJCQwHEwOrU5AdAQMCBYQZBYkM X-IronPort-AV: E=Sophos;i="4.44,475,1249250400"; d="scan'208";a="37126663" Received: from mail-ew0-f223.google.com ([209.85.219.223]) by mail1-smtp-roc.national.inria.fr with ESMTP; 30 Sep 2009 01:00:16 +0200 Received: by ewy23 with SMTP id 23so647354ewy.26 for ; Tue, 29 Sep 2009 16:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=uutaM5a+rQAB5EvRxBmKzBf1TBy2/MumziemjdL4j8I=; b=YJP21jhIX4/lKnjw7sdPGi+NfD748HFpAxI/M0WKe0GIfTS+2GcbiqUaoXm46H5xdy bmd502lDUhJRZq7LeSH3Jq/Iq+HM9ReZsoYIuDBPeTPGAKAMTJpicjzbg3aQR0zTZP5O ipvgxuBrnTxrdo5qRmSP/rShtqvr46bBoWJcA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=O3v+pIdZZ1U3ERJ9l0ygNmCSDoRLFfg6QXlodnQFU/lK7C402rvvhuIq/Bq373bJmQ q5y3p/UK8d/WGUEofc0TD6Oz057psm2DMCIemwHwpJp6212M6LrkubCZe2TPYwp0qgjY re24PKuEMl4eQBU1z36XCdUsUpQGHiI8ZdhJA= MIME-Version: 1.0 Sender: mikkelfj@gmail.com Received: by 10.216.35.11 with SMTP id t11mr1178963wea.12.1254265215794; Tue, 29 Sep 2009 16:00:15 -0700 (PDT) In-Reply-To: <9d3ec8300909280806me88dccbm2a6e4d98c9de191@mail.gmail.com> References: <20090928121745.GA19803@annexia.org> <9d3ec8300909280806me88dccbm2a6e4d98c9de191@mail.gmail.com> Date: Wed, 30 Sep 2009 01:00:15 +0200 X-Google-Sender-Auth: 0ba638e8c61c890b Message-ID: Subject: Re: [Caml-list] xpath or alternatives From: =?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?= To: Till Varoquaux Cc: Yaron Minsky , "caml-list@inria.fr" , Richard Jones Content-Type: text/plain; charset=UTF-8 X-Spam: no; 0.00; mikkel:01 rgensen:01 mikkel:01 yaron:01 combinator:01 parser:01 parser:01 syntax:01 abstraction:01 one-liner:01 git:98 config:01 parsing:01 caml-list:01 data:02 In line with what Yaron suggests, you can use a combinator parser. I do this to parse json, and this parser could be adapted to xml by focusing on basic syntax and ignoring the details, or you could prefilter xml and use the json parser directly. See the Fleece parser embedded here: There is also the object abstraction that dives into an object hierarchy after parsing, see the Objects module. The combination of these two makes it quite easy to work on structured data, but 3 lines only come after some xml adaptation work - but you can see many one-liner json access in the last part of the file. http://git.dvide.com/pub/symbiosis/tree/myocamlbuild_config.ml Otherwise there is xmlm which is self-contained in single xml file, and as I recall, has some sort of zipper navigator. (I initially intended to use it before deciding on the json format): http://erratique.ch/software/xmlm