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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 24F7BBBC4 for ; Tue, 17 Mar 2009 12:53:34 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhwFAHMsv0nU436xaGdsb2JhbACBTpQNDQsDBwcRA746AYN9BmE X-IronPort-AV: E=Sophos;i="4.38,378,1233529200"; d="scan'208";a="24442584" Received: from moutng.kundenserver.de ([212.227.126.177]) by mail3-smtp-sop.national.inria.fr with ESMTP; 17 Mar 2009 12:53:33 +0100 Received: from office1.lan.sumadev.de (dslb-088-068-217-109.pools.arcor-ip.net [88.68.217.109]) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis) id 0ML29c-1LjXrR0yQS-0001V7; Tue, 17 Mar 2009 12:53:33 +0100 Received: from [192.168.5.101] (unknown [192.168.5.101]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id D1B6FC0E8E; Tue, 17 Mar 2009 12:53:20 +0100 (CET) Subject: Re: [Caml-list] XML output From: Gerd Stolpmann To: =?ISO-8859-1?Q?R=E9mi?= Dewitte Cc: caml-list In-Reply-To: <2184b2340903170401m3c5ba0a5yd0daf37cf4c9ddbb@mail.gmail.com> References: <2184b2340903170401m3c5ba0a5yd0daf37cf4c9ddbb@mail.gmail.com> Content-Type: text/plain; charset=utf-8 Date: Tue, 17 Mar 2009 12:55:33 +0100 Message-Id: <1237290933.1775.11.camel@flake.lan.gerd-stolpmann.de> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V01U2FsdGVkX1878V6BPYaZSKl2TnNvSrMr7fLCVrtw9vfRGeu TDWFDIiBADM/RaeAq6kM0+oNwfTfF4aJBw147fRXi5pLoreoxK IZ7y5MaG84fVDsnwEZ2PcrhvInYsx8O X-Spam: no; 0.00; gerd:01 stolpmann:01 gerd:01 pxp:01 pxp:01 pxp-:01 pxp-:01 printf:01 printf:01 netencoding:01 ocamlnet-:01 netencoding:01 stolpmann:01 viktoriastr:01 64293:01 Am Dienstag, den 17.03.2009, 12:01 +0100 schrieb R=C3=A9mi Dewitte: > Hello, >=20 > I have used pxp to parse xml and I am happy with it. I'd like now to > produce xml and wonder what are the options to do so (possibly the > simpliest). Maybe not the simplest: Use the PXP preprocessor to create the output tree, and print the tree: http://projects.camlcity.org/projects/dl/pxp-1.2.1/doc/manual/html/ref/In= tro_preprocessor.html http://projects.camlcity.org/projects/dl/pxp-1.2.1/doc/manual/html/ref/Px= p_document.document.html#2_WritingdocumentsasXMLtext >=20 > I think I am going to start with the Printf module. I wonder how well > it handles utf8 for example.=20 UTF-8 are just bytes for printf. > And I'll have to write a kind of xml_encode function. I am pretty sure > it has already be done somewhere ! let xml_encode =3D Netencoding.Html.encode=20 ~in_enc:`Enc_utf8 ~out_enc:`Enc_usascii ~prefer_names:false () That would assume the input is UTF-8 encoded, and the output is ASCII-encoded. You can control which ASCII characters get the special XML representation &...; with the unsafe_chars optional argument. Docs are at http://projects.camlcity.org/projects/dl/ocamlnet-2.2.9/doc/html-main/Net= encoding.Html.html Gerd --=20 ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany=20 gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------