From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 2001EBBBB for ; Tue, 28 Feb 2006 16:23:41 +0100 (CET) Received: from mail.tcs.inf.tu-dresden.de (tcs01.inf.tu-dresden.de [141.76.75.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1SFNedR018563 for ; Tue, 28 Feb 2006 16:23:40 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTP id <0IVE00EPWLFGS000@mail.tcs.inf.tu-dresden.de> for caml-list@yquem.inria.fr; Tue, 28 Feb 2006 16:23:40 +0100 (MET) Received: from tcs01.inf.tu-dresden.de ([127.0.0.1]) by localhost (mail.tcs.inf.tu-dresden.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24699-10 for ; Tue, 28 Feb 2006 16:23:40 +0100 (MET) Received: from ithif59.inf.tu-dresden.de (ithif59.inf.tu-dresden.de [141.76.75.59]) by mail.tcs.inf.tu-dresden.de (Sun Java System Messaging Server 6.1 HotFix 0.06 (built Nov 11 2004)) with ESMTPS id <0IVE00EH9LFGQW00@mail.tcs.inf.tu-dresden.de> for caml-list@yquem.inria.fr; Tue, 28 Feb 2006 16:23:40 +0100 (MET) Received: from tews by ithif59.inf.tu-dresden.de with local (Exim 4.50) id 1FE6hQ-0007FU-Bu for caml-list@yquem.inria.fr; Tue, 28 Feb 2006 16:23:40 +0100 Date: Tue, 28 Feb 2006 16:23:39 +0100 From: Hendrik Tews Subject: xml tree -- variant type tree To: caml-list@yquem.inria.fr Message-id: <17412.27387.963123.675231@ithif59.inf.tu-dresden.de> MIME-version: 1.0 X-Mailer: VM 7.19 under Emacs 21.4.1 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Virus-Scanned: amavisd-new at tcs.inf.tu-dresden.de X-Miltered: at concorde with ID 44046AFC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 corresponds:01 nodes:01 humps:01 gerd:01 pxp:01 syntax:01 parser:01 ocaml:01 syntax:01 ocaml:01 hendrik:01 elsa:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hi, I would like to read an XML file into an element of some variant type, where each constructor corresponds to precisely one type of xml nodes. Of course I would need to define the variant type beforehand. But how to proceed then? The humps give me the impression that the right library to use is Gerd Stolpmanns pxp. However, this library will produce an object tree, which I could probably convert into a variant type with some effort. An alternative would be to use XML-Light, which produces string labelled trees, and to translate these string trees myself. Is there some better solution? Background: I would like to manipulate abstract syntax trees of C++ programs. I couldn't find a C++ parser in Ocaml, therefore I would like to use Elkhound/Elsa (http://www.cs.berkeley.edu/~smcpeak/elkhound/), which can output the abstract syntax tree as xml file. Extending Elsa is not an option, because for ast manipulations I prefer ocaml pattern matching over C++ visitors. Bye, Hendrik