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=1.0 required=5.0 tests=AWL,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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 3AABDBC6D for ; Thu, 7 Feb 2008 00:51:22 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAPDWqUfAXQImh2dsb2JhbACQLgEBAQgKKYEVlQWGDQ X-IronPort-AV: E=Sophos;i="4.25,314,1199660400"; d="scan'208";a="7020018" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 07 Feb 2008 00:51:21 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m16NpLqw027465 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 7 Feb 2008 00:51:22 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAPDWqUfRVZK0k2dsb2JhbACQLgEBAQEHBAQLCBaBF5UFhg0 X-IronPort-AV: E=Sophos;i="4.25,314,1199660400"; d="scan'208";a="7734876" Received: from wa-out-1112.google.com ([209.85.146.180]) by mail1-smtp-roc.national.inria.fr with ESMTP; 07 Feb 2008 00:51:20 +0100 Received: by wa-out-1112.google.com with SMTP id m34so827738wag.9 for ; Wed, 06 Feb 2008 15:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; bh=SSv6+ZfMonmtw0e3nAXbOFcXO1Eo907yaDdrIbahFpY=; b=IhuiJ/Wccw4aJK+FiNrEdYadzKbLfXomyb/ylvxzISGrnwBMJ+gepUo5d6BNJ4sljII3nOWTuSeRLcnLavTFzoTf4DA+Vm2dKVpLL9pC9FrlrCIExjv6IV2rhgjjphIdOqQdPZPWeocnrnSB4eVgSnlKPUA4F1bQxNvdTeLZDeY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; b=yHibvjL9lP5+YHva9ZTvvsWx35061B/77tpuldeUplCRhgINttH4adyG3xs8ooUBq22dKxvx0fj4PpftFs4c+iKbyhcvqhAAnlKcXpiJkZxgFElUI/MkB52FhEJLmf4YhlON+XS70YP9sNZoKv1IWrILIRXYM6z2PknxDfwZvKU= Received: by 10.114.171.1 with SMTP id t1mr5159207wae.83.1202341879853; Wed, 06 Feb 2008 15:51:19 -0800 (PST) Received: from ?192.168.1.58? ( [85.2.96.197]) by mx.google.com with ESMTPS id d26sm1425260nfh.25.2008.02.06.15.51.18 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Feb 2008 15:51:19 -0800 (PST) Cc: caml-list List Message-Id: <0D5D170A-D29F-493D-94A6-610838E65624@erratique.ch> From: =?ISO-8859-1?Q?B=FCnzli_Daniel?= To: Alain Frisch In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v915) Subject: Re: [Caml-list] xmlm and names(paces) Date: Thu, 7 Feb 2008 00:51:23 +0100 References: <998006DB-6778-42F1-B2F4-31CB5E9AA6A2@erratique.ch> <47AA2C33.70902@frisch.fr> X-Mailer: Apple Mail (2.915) Sender: =?ISO-8859-1?Q?Daniel=20B=FCnzli?= X-Miltered: at discorde with ID 47AA47F9.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 bunzli:01 variants:01 val:01 bool:01 bool:01 val:01 prolog:01 prolog:01 caml-list:01 int:01 int:01 prefixes:01 variant:02 Le 6 f=E9vr. 08 =E0 23:56, B=FCnzli Daniel a =E9crit : > Of course this means more work for the client, but it makes the =20 > basic interface simpler and it allows the client > to use variants instead of simply shorter prefixes. Now that I think of it instead of (what I have now) : > type name =3D string * string > type attribute =3D name * string > type tag =3D name * attribute list > > val input : ?enc:encoding option -> ?strip:bool -> > ?ns: (string -> string option) -> > ?entity: (string -> string option) -> > ?prolog: (dtd -> unit) -> > ?prune:(tag -> 'a -> bool) -> > ?s:(tag -> 'a -> 'a) ->=09 > ?e:(tag -> 'a -> 'a) -> > ?d:(string -> 'a -> 'a) -> 'a -> input -> > [ `Value of 'a | `Error of (int * int) * error ] (~s is for start tag, ~e is for end tag (the full start tag is given =20 again), ~d is for data) Why not have a callback ~name which is given the expanded name =20 (uri,local) allows the client to do whathever it wishes and a callback ~att to build attributes : > val input : ?enc:encoding option -> ?strip:bool -> > ?ns: (string -> string option) -> > ?entity: (string -> string option) -> > name: (string -> string -> 'n) -> > att: ('n -> string -> 'att) > ?prolog: (dtd -> unit) -> > ?prune:('n * 'att -> 'a -> bool) -> > ?s:('n * 'att list -> 'a -> 'a) ->=09 > ?e:('n * 'att list -> 'a -> 'a) -> > ?d:(string -> 'a -> 'a) -> 'a -> input -> > [ `Value of 'a | `Error of (int * int) * error ] This allows you to give precise variant cases for the things your =20 process and have a catch all case for what you are not interested in. =20= Output would be polymorphised accordingly and the client provides =20 inverses of ~name ('n -> string * string) and ~att ('att -> 'n * =20 string). On the other hand the work performed by ~name and ~att can be done by =20= the client in ~s or ~e. The only thing the latter solution brings is =20 to avoid folding over the tag type if you want to transform it. So =20 finally I don't think it is worth it (especially because the =20 polymorphised output feels cumbersome). Any comment ? Daniel=