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 C3AA0BBBB for ; Tue, 28 Feb 2006 16:42:54 +0100 (CET) Received: from mxintern.schlund.de (mxintern.kundenserver.de [212.227.126.204]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1SFgrtU021616 for ; Tue, 28 Feb 2006 16:42:54 +0100 Received: from [172.17.36.11] (helo=schluck.use.schlund.de) by mxintern.kundenserver.de with esmtp (Exim 4.34) id 1FE6zq-0000NX-Te; Tue, 28 Feb 2006 16:42:43 +0100 From: Michael Wohlwend To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] xml tree -- variant type tree Date: Tue, 28 Feb 2006 16:43:28 +0100 User-Agent: KMail/1.9.1 References: <17412.27387.963123.675231@ithif59.inf.tu-dresden.de> In-Reply-To: <17412.27387.963123.675231@ithif59.inf.tu-dresden.de> X-Face: S)[vu%Bha1d&ej9GfwAq~7C}A,y[B.uS}+D6'hb~xPwsxymw$fnCOaMe<=?utf-8?q?*bnUajSBR=5Fm=3FR=0A=09?=@V3;iX8[A}z`.%pEQ1r7iZhN8#ktTCBQ}&mkx>=RH&l|l6\]NZI@ Cc: Hendrik Tews MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200602281643.29063.micha-1@fantasymail.de> X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Miltered: at concorde with ID 44046F7D.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 hendrik:01 tews:01 ocaml's:01 expat:98 expat:98 wrote:01 short:01 structures:01 data:02 variant:02 tree:02 tree:02 parse:02 parse:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO,SPF_FAIL autolearn=disabled version=3.0.3 On Tuesday 28 February 2006 16:23, Hendrik Tews wrote: > Hi, > An alternative would be to use XML-Light, which produces string > labelled trees, and to translate these string trees myself. I found that difficult > Is there some better solution? I have used expat to parse my xml. To get more managable code I only use expat to fill a queue with the tags found: Start(tag,attr list) and End(tag,text). Then I make a stream of the function which reads that queue and can use ocaml's streamparsers to parse my xml and build my data structures quite easy. It's short, fast and easy changeable. The streamparses can watch only for the relevant tags to get the desired information and build the result. Michael