* XML output
@ 2009-03-17 11:01 Rémi Dewitte
2009-03-17 11:55 ` [Caml-list] " Gerd Stolpmann
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Rémi Dewitte @ 2009-03-17 11:01 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 393 bytes --]
Hello,
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).
I think I am going to start with the Printf module. I wonder how well it
handles utf8 for example. And I'll have to write a kind of xml_encode
function. I am pretty sure it has already be done somewhere !
Many thanks,
Rémi
[-- Attachment #2: Type: text/html, Size: 418 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] XML output
2009-03-17 11:01 XML output Rémi Dewitte
@ 2009-03-17 11:55 ` Gerd Stolpmann
2009-03-17 12:00 ` Michaël Le Barbier
2009-03-17 12:53 ` Sylvain Le Gall
2 siblings, 0 replies; 7+ messages in thread
From: Gerd Stolpmann @ 2009-03-17 11:55 UTC (permalink / raw)
To: Rémi Dewitte; +Cc: caml-list
Am Dienstag, den 17.03.2009, 12:01 +0100 schrieb Rémi Dewitte:
> Hello,
>
> 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/Intro_preprocessor.html
http://projects.camlcity.org/projects/dl/pxp-1.2.1/doc/manual/html/ref/Pxp_document.document.html#2_WritingdocumentsasXMLtext
>
> I think I am going to start with the Printf module. I wonder how well
> it handles utf8 for example.
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 =
Netencoding.Html.encode
~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/Netencoding.Html.html
Gerd
--
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de
Phone: +49-6151-153855 Fax: +49-6151-997714
------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Caml-list] XML output
2009-03-17 11:01 XML output Rémi Dewitte
2009-03-17 11:55 ` [Caml-list] " Gerd Stolpmann
@ 2009-03-17 12:00 ` Michaël Le Barbier
2009-03-17 12:53 ` Sylvain Le Gall
2 siblings, 0 replies; 7+ messages in thread
From: Michaël Le Barbier @ 2009-03-17 12:00 UTC (permalink / raw)
To: Rémi Dewitte; +Cc: caml-list
Le 17 mars 09 à 12:01, Rémi Dewitte a écrit :
> Hello,
>
> 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).
>
> I think I am going to start with the Printf module. I wonder how
> well it handles utf8 for example. And I'll have to write a kind of
> xml_encode function. I am pretty sure it has already be done
> somewhere !
I am also very interesting in this question. Besides Gerd's
suggestion, is there a solution that can help writing SGML-ish thingies?
Maybe the Eiom library (part of the OCsigen project) can also interest
you, although I never used it and that it might be focused on HTML.
--
Cheers,
Michaël
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: XML output
2009-03-17 11:01 XML output Rémi Dewitte
2009-03-17 11:55 ` [Caml-list] " Gerd Stolpmann
2009-03-17 12:00 ` Michaël Le Barbier
@ 2009-03-17 12:53 ` Sylvain Le Gall
2009-03-17 13:02 ` Re : [Caml-list] " Matthieu Wipliez
2 siblings, 1 reply; 7+ messages in thread
From: Sylvain Le Gall @ 2009-03-17 12:53 UTC (permalink / raw)
To: caml-list
On 17-03-2009, Rémi Dewitte <remi@gide.net> wrote:
>
> I think I am going to start with the Printf module. I wonder how well it
> handles utf8 for example. And I'll have to write a kind of xml_encode
> function. I am pretty sure it has already be done somewhere !
>
Maybe it is a bit overkilling, but there is also ocamlduce.
See there:
http://www.cduce.org/ocaml
(dev for ocaml 3.11:)
http://ocamlduce.forge.ocamlcore.org/
http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=ocamlduce/ocamlduce.git;a=summary
OCamlduce can also be used with Eliom/OCsigen.
AFAIK, using ocamlduce can help you to type check your output tree
directly within OCaml compiler...
Regards
Sylvain Le Gall
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re : [Caml-list] Re: XML output
2009-03-17 12:53 ` Sylvain Le Gall
@ 2009-03-17 13:02 ` Matthieu Wipliez
2009-03-17 13:20 ` Rémi Dewitte
2009-03-17 16:20 ` Re : " Michael Ekstrand
0 siblings, 2 replies; 7+ messages in thread
From: Matthieu Wipliez @ 2009-03-17 13:02 UTC (permalink / raw)
To: Sylvain Le Gall, caml-list
Yet another solution is Xmlm by Daniel Bünzli.
http://erratique.ch/software/xmlm
This is probably the easiest and lightweight solution: Xmlm comes as a single module and its interface, and it's BSD so you can just copy/paste it into your project.
Cheers,
Matthieu
----- Message d'origine ----
> De : Sylvain Le Gall <sylvain@le-gall.net>
> À : caml-list@inria.fr
> Envoyé le : Mardi, 17 Mars 2009, 13h53mn 30s
> Objet : [Caml-list] Re: XML output
>
> On 17-03-2009, Rémi Dewitte wrote:
> >
> > I think I am going to start with the Printf module. I wonder how well it
> > handles utf8 for example. And I'll have to write a kind of xml_encode
> > function. I am pretty sure it has already be done somewhere !
> >
>
> Maybe it is a bit overkilling, but there is also ocamlduce.
>
> See there:
> http://www.cduce.org/ocaml
> (dev for ocaml 3.11:)
> http://ocamlduce.forge.ocamlcore.org/
> http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=ocamlduce/ocamlduce.git;a=summary
>
> OCamlduce can also be used with Eliom/OCsigen.
>
> AFAIK, using ocamlduce can help you to type check your output tree
> directly within OCaml compiler...
>
> Regards
> Sylvain Le Gall
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re : [Caml-list] Re: XML output
2009-03-17 13:02 ` Re : [Caml-list] " Matthieu Wipliez
@ 2009-03-17 13:20 ` Rémi Dewitte
2009-03-17 16:20 ` Re : " Michael Ekstrand
1 sibling, 0 replies; 7+ messages in thread
From: Rémi Dewitte @ 2009-03-17 13:20 UTC (permalink / raw)
To: Matthieu Wipliez; +Cc: Sylvain Le Gall, caml-list
[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]
Thanks every one !
I guess I have to pick the one now :)
Rémi
On Tue, Mar 17, 2009 at 14:02, Matthieu Wipliez <mwipliez@yahoo.fr> wrote:
>
> Yet another solution is Xmlm by Daniel Bünzli.
>
> http://erratique.ch/software/xmlm
>
> This is probably the easiest and lightweight solution: Xmlm comes as a
> single module and its interface, and it's BSD so you can just copy/paste it
> into your project.
>
> Cheers,
> Matthieu
>
>
>
> ----- Message d'origine ----
> > De : Sylvain Le Gall <sylvain@le-gall.net>
> > À : caml-list@inria.fr
> > Envoyé le : Mardi, 17 Mars 2009, 13h53mn 30s
> > Objet : [Caml-list] Re: XML output
> >
> > On 17-03-2009, Rémi Dewitte wrote:
> > >
> > > I think I am going to start with the Printf module. I wonder how well
> it
> > > handles utf8 for example. And I'll have to write a kind of xml_encode
> > > function. I am pretty sure it has already be done somewhere !
> > >
> >
> > Maybe it is a bit overkilling, but there is also ocamlduce.
> >
> > See there:
> > http://www.cduce.org/ocaml
> > (dev for ocaml 3.11:)
> > http://ocamlduce.forge.ocamlcore.org/
> >
> http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=ocamlduce/ocamlduce.git;a=summary
> >
> > OCamlduce can also be used with Eliom/OCsigen.
> >
> > AFAIK, using ocamlduce can help you to type check your output tree
> > directly within OCaml compiler...
> >
> > Regards
> > Sylvain Le Gall
> >
> > _______________________________________________
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
[-- Attachment #2: Type: text/html, Size: 3601 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re : Re: XML output
2009-03-17 13:02 ` Re : [Caml-list] " Matthieu Wipliez
2009-03-17 13:20 ` Rémi Dewitte
@ 2009-03-17 16:20 ` Michael Ekstrand
1 sibling, 0 replies; 7+ messages in thread
From: Michael Ekstrand @ 2009-03-17 16:20 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 803 bytes --]
Matthieu Wipliez <mwipliez@yahoo.fr> writes:
> Yet another solution is Xmlm by Daniel Bünzli.
>
> http://erratique.ch/software/xmlm
>
> This is probably the easiest and lightweight solution: Xmlm comes as a
> single module and its interface, and it's BSD so you can just
> copy/paste it into your project.
I second the xmlm suggestion. Polling event-based parsing is very slick
and maps well into the functional paradigm, and its XML writing support
(generating a stream of events identical to those you read) makes
generation quite intuitive and reliable.
- Michael
--
mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files? I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.
[-- Attachment #2: Type: application/pgp-signature, Size: 196 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-03-17 16:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-17 11:01 XML output Rémi Dewitte
2009-03-17 11:55 ` [Caml-list] " Gerd Stolpmann
2009-03-17 12:00 ` Michaël Le Barbier
2009-03-17 12:53 ` Sylvain Le Gall
2009-03-17 13:02 ` Re : [Caml-list] " Matthieu Wipliez
2009-03-17 13:20 ` Rémi Dewitte
2009-03-17 16:20 ` Re : " Michael Ekstrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox