caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Looking for OCaml code to load & save XML files
@ 2004-02-28 13:44 David MENTRE
  2004-02-28 15:24 ` Nicolas Cannasse
  0 siblings, 1 reply; 10+ messages in thread
From: David MENTRE @ 2004-02-28 13:44 UTC (permalink / raw)
  To: caml-list

Hello,

I'm looking for OCaml code to manipulate XML files. More specifically,
I'm looking for code that can:

 1. save and load XML files from/to OCaml data structure[1];

 2. validate the files against a DTD and maybe an XML schema;

 3. (might be contradictory to 2) allow unknown XML tags to be skipped
    for forward and backward compatibility;

 4. have a license compatible with GNU GPL.

We intend to use XML as a backup format to save and restore a kind of
database. In the long term, the XML files could be quite big (several
tens of megabyte).

Because the current program is still under development, I would like to
provide forward and backward compatibility. More specifically, I would
like to allow my program to skip unknown tags, so that I could enhance
the database while still loading old and new bases.

I think I might also use the library to transform from one version of my
DTD to a new version, as the database format evolve. So I might need to
write ad-hoc tools for XML transformation.

I've found on the Hump a lot of XML libraries for OCaml so I ask on this
mailing list advices from their authors and users on which one could
fulfill my requirements.

Moreover, I'm new to XML. So if somebody has advices on how to
accomplish my goals, I would be pleased to hear them.

Many thanks in advance,
Yours,
david
-- 
 David Mentré <dmentre@linux-france.org>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 13:44 [Caml-list] Looking for OCaml code to load & save XML files David MENTRE
@ 2004-02-28 15:24 ` Nicolas Cannasse
  2004-02-28 15:38   ` Benjamin Geer
  2004-02-29 17:46   ` David MENTRE
  0 siblings, 2 replies; 10+ messages in thread
From: Nicolas Cannasse @ 2004-02-28 15:24 UTC (permalink / raw)
  To: caml-list, David MENTRE

[...]
> I've found on the Hump a lot of XML libraries for OCaml so I ask on this
> mailing list advices from their authors and users on which one could
> fulfill my requirements.
>
> Moreover, I'm new to XML. So if somebody has advices on how to
> accomplish my goals, I would be pleased to hear them.

You can use XmlLight if you need something... light. If performances and
memory are not critical (only DOM), it should be enough for most of your
usages, and is a good way of starting with XML since it's very easy to use
and manipulate, and support DTD (but not schema). If you need more features
then PXP is your friend, but is a lot more difficult to handle.
My advice : first experiment XmlLight and then switch to PXP if you lack
features.

http://tech.motion-twin.com/xmllight

Regards,
Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 15:24 ` Nicolas Cannasse
@ 2004-02-28 15:38   ` Benjamin Geer
  2004-02-28 15:44     ` Nicolas Cannasse
  2004-02-28 18:50     ` Stefano Zacchiroli
  2004-02-29 17:46   ` David MENTRE
  1 sibling, 2 replies; 10+ messages in thread
From: Benjamin Geer @ 2004-02-28 15:38 UTC (permalink / raw)
  To: Nicolas Cannasse; +Cc: caml-list, David MENTRE

Nicolas Cannasse wrote:>
> You can use XmlLight if you need something... light. If performances and
> memory are not critical (only DOM), it should be enough for most of your
> usages, and is a good way of starting with XML since it's very easy to use
> and manipulate, and support DTD (but not schema). If you need more features
> then PXP is your friend, but is a lot more difficult to handle.

PXP doens't support schema either, but GMetaDOM (a wrapper around the 
GNOME XML libraries) seems to:

http://gmetadom.sourceforge.net/

Ben

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 15:38   ` Benjamin Geer
@ 2004-02-28 15:44     ` Nicolas Cannasse
  2004-02-28 18:50     ` Stefano Zacchiroli
  1 sibling, 0 replies; 10+ messages in thread
From: Nicolas Cannasse @ 2004-02-28 15:44 UTC (permalink / raw)
  To: Benjamin Geer; +Cc: caml-list, David MENTRE

> > You can use XmlLight if you need something... light. If performances and
> > memory are not critical (only DOM), it should be enough for most of your
> > usages, and is a good way of starting with XML since it's very easy to
use
> > and manipulate, and support DTD (but not schema). If you need more
features
> > then PXP is your friend, but is a lot more difficult to handle.
>
> PXP doens't support schema either, but GMetaDOM (a wrapper around the
> GNOME XML libraries) seems to:
>
> http://gmetadom.sourceforge.net/
>
> Ben

I forgot to say the following : XmlLight is 100% pure OCaml, and is not a
wrapper on another library. That means that it will compile and work the
same on all ocaml-supported architectures.

Nicolas Cannnasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 15:38   ` Benjamin Geer
  2004-02-28 15:44     ` Nicolas Cannasse
@ 2004-02-28 18:50     ` Stefano Zacchiroli
  2004-02-28 20:02       ` Giuseppe Castagna
  2004-02-29 17:53       ` Claudio Sacerdoti Coen
  1 sibling, 2 replies; 10+ messages in thread
From: Stefano Zacchiroli @ 2004-02-28 18:50 UTC (permalink / raw)
  To: caml-list

On Sat, Feb 28, 2004 at 03:38:02PM +0000, Benjamin Geer wrote:
> PXP doens't support schema either, but GMetaDOM (a wrapper around the 
> GNOME XML libraries) seems to:
> http://gmetadom.sourceforge.net/

No it doesn't. GMetaDOM is just a collection of bindings for the gdome2
library, one of them is the OCaml binding.

The gdome2 library is the Gnome implementation of the DOM API
implemented on top of the libxml2 Gnome library. DOM API is just a
(standardized) way to access and manipulate XML documents, it doesn't
support XML Schema validation.

Galax (I don't have the URL at hand, but you can google for it + "bell
labs") is a project to implement xquery and, as a part of this project,
it will implement also (part of) XML Schema. I'm almost sure that
someone of the galax upstream authors is subscribed to this list and can
give you more details about galax's roadmap.

Cheers.

-- 
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 18:50     ` Stefano Zacchiroli
@ 2004-02-28 20:02       ` Giuseppe Castagna
  2004-02-29 17:53       ` Claudio Sacerdoti Coen
  1 sibling, 0 replies; 10+ messages in thread
From: Giuseppe Castagna @ 2004-02-28 20:02 UTC (permalink / raw)
  To: Stefano Zacchiroli; +Cc: caml-list

On Sat, 2004-02-28 at 19:50, Stefano Zacchiroli wrote:
> 
> Galax (I don't have the URL at hand, but you can google for it + "bell
> labs") is a project to implement xquery and, as a part of this project,
> it will implement also (part of) XML Schema. I'm almost sure that
> someone of the galax upstream authors is subscribed to this list and can
> give you more details about galax's roadmap.
> 

I would not bet all my money on Galax future. Jerome Simeon has recently
left bell-labs to IBM and I'm afraid that this may jeopardize Galax's
development. Hope I am wrong, in any case the url is:
http://db.bell-labs.com/galax/



---Beppe---

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 15:24 ` Nicolas Cannasse
  2004-02-28 15:38   ` Benjamin Geer
@ 2004-02-29 17:46   ` David MENTRE
  2004-02-29 18:13     ` Nicolas Cannasse
  1 sibling, 1 reply; 10+ messages in thread
From: David MENTRE @ 2004-02-29 17:46 UTC (permalink / raw)
  To: Nicolas Cannasse; +Cc: caml-list, David MENTRE

Hello Nicolas,

"Nicolas Cannasse" <warplayer@free.fr> writes:

> My advice : first experiment XmlLight and then switch to PXP if you lack
> features.
>
> http://tech.motion-twin.com/xmllight

I like you advice. I've looked at your library and it's conciseness and
lack of dependencies pleases me. 

BTW, I need to save some short binary data in the XML format (e.g. MD5
128bits hash). Therefore, I would like to transform from/to an OCaml
binary string type into a string suitable for printing in an XML file
(in a CDATA field). Which code would you recommend to do that the "XML
way"?  At first sight, I intend to use Gerd's code to encode/decode MIME
and base64 strings.

As another side note, I also intend to read and write gziped XML files,
using Xavier's camlzip package. As your module uses Lexing.from_* to get
input file, I'll probably add an SFunction source type to be able to use
Lexing.from_function. In the same way, I'll probably modify your output
functions (Xml.to_string) to be able to ouput into a Gzip.out_channel
without producing the whole XML file in a string.

I'll gladly accept any advice on how to use your code,
Yours,
d.
-- 
 David Mentré <dmentre@linux-france.org>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-28 18:50     ` Stefano Zacchiroli
  2004-02-28 20:02       ` Giuseppe Castagna
@ 2004-02-29 17:53       ` Claudio Sacerdoti Coen
  1 sibling, 0 replies; 10+ messages in thread
From: Claudio Sacerdoti Coen @ 2004-02-29 17:53 UTC (permalink / raw)
  To: caml-list

> > PXP doens't support schema either, but GMetaDOM (a wrapper around the 
> > GNOME XML libraries) seems to:
> > http://gmetadom.sourceforge.net/
> 
> No it doesn't.

 It doesn't, but it easily could. Indeed GDOMe2 is implemented on top
 of libxml that performs Schema validation. Thus enabling Schema validation
 can be done quite easily. The real problem is that DOM Level 2 has no
 API for Schema validation. Thus the "extra parameters" should be
 considered an hack (and thus put in the Gdome.domImpl class).

 GMetaDOM is not 100% full ocaml. But it is 100% DOM compliant (since it
 is automatically generated from the DOM reccomendation). This can be
 either a good feature (e.g. if you are porting code from another language)
 or a bad feature (since the DOM API forces an imperative coding style).
 Finally, GMetaDOM is the only solution available if you want to use
 bindings to external C libraries whose input or output are Gnome DOM
 documents (e.g. some Gtk2 widgets as GtkMathView).

 XMLLight is 100% full ocaml, but it is not even 100% compliant to the
 XML Reccomendation. Thus I do not reccomend it: either you can parse
 any XML file or you cannot (and sooner or later something will bite you).

 PXP is 100% full ocaml and 100% XML compliant (but it does not implement
 the DOM interface nor XML Schema). It is is probably the best solution
 if you are not obliged to use GMetaDOM (because of the standard imperative
 API or the need of using other bindings).

					Cheers,
					C.S.C.

-- 
----------------------------------------------------------------
Real name: Claudio Sacerdoti Coen
PhD Student in Computer Science at University of Bologna
E-mail: sacerdot@cs.unibo.it
http://www.cs.unibo.it/~sacerdot
----------------------------------------------------------------

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-29 17:46   ` David MENTRE
@ 2004-02-29 18:13     ` Nicolas Cannasse
  2004-03-01  8:09       ` lehalle@miriad
  0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Cannasse @ 2004-02-29 18:13 UTC (permalink / raw)
  To: David MENTRE; +Cc: OCaml

> > My advice : first experiment XmlLight and then switch to PXP if you lack
> > features.
> >
> > http://tech.motion-twin.com/xmllight
>
> I like you advice. I've looked at your library and it's conciseness and
> lack of dependencies pleases me.
>
> BTW, I need to save some short binary data in the XML format (e.g. MD5
> 128bits hash). Therefore, I would like to transform from/to an OCaml
> binary string type into a string suitable for printing in an XML file
> (in a CDATA field). Which code would you recommend to do that the "XML
> way"?  At first sight, I intend to use Gerd's code to encode/decode MIME
> and base64 strings.

If your goal is to minimise dependencies, just writing some lines of B64
encode/decode is a good idea (btw, this could be a good add-on for ExtLib :
http://ocaml-lib.sf.net ).

> As another side note, I also intend to read and write gziped XML files,
> using Xavier's camlzip package. As your module uses Lexing.from_* to get
> input file, I'll probably add an SFunction source type to be able to use
> Lexing.from_function. In the same way, I'll probably modify your output
> functions (Xml.to_string) to be able to ouput into a Gzip.out_channel
> without producing the whole XML file in a string.
>
> I'll gladly accept any advice on how to use your code,

I think you don't need any special advice in order to add the SFunction to
XmlLight, it looks easy.
For gzip, XmlLight has 2 printers : Xml.to_string for "compact" mode
(without any line returns or indentation) and Xml.to_string_fmt for
"formatted" mode (a lot more user-readable). Writing a custom "compact"
printer which directly output the data into a Gzip.out_channel is also
something easy to do (look at to_string in xml.ml for example). Another way
is to add an event-driven printer that would be able to output on any
underlying data structure. If you need this, don't hesitate to ask and I
will add this to XmlLight.

You can contact me again if you have any question.
Regards,

Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Looking for OCaml code to load & save XML files
  2004-02-29 18:13     ` Nicolas Cannasse
@ 2004-03-01  8:09       ` lehalle@miriad
  0 siblings, 0 replies; 10+ messages in thread
From: lehalle@miriad @ 2004-03-01  8:09 UTC (permalink / raw)
  To: OCaml

On Sun, 29 Feb 2004 19:13:03 +0100, Nicolas Cannasse <warplayer@free.fr> 
wrote:
>> > My advice : first experiment XmlLight and then switch to PXP if you
> lack
>> > features.
>> > http://tech.motion-twin.com/xmllight

I use xmllight : it's light and usefull ; I will use it in my next release 
of ocamaweb (I hope that it will be avalable in few monthes)


-- 
Charles-Albert Lehalle --- MIRIAD Technologies
Responsable Développements Algorithmiques et Applications
mailto:charles.lehalle@miriadtech.com
keyserver: http://pgp.mit.edu/
tel : 0156431816 - fax: 0156431828
8 av Hoche - 75008 PARIS - FRANCE

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-03-01  8:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-28 13:44 [Caml-list] Looking for OCaml code to load & save XML files David MENTRE
2004-02-28 15:24 ` Nicolas Cannasse
2004-02-28 15:38   ` Benjamin Geer
2004-02-28 15:44     ` Nicolas Cannasse
2004-02-28 18:50     ` Stefano Zacchiroli
2004-02-28 20:02       ` Giuseppe Castagna
2004-02-29 17:53       ` Claudio Sacerdoti Coen
2004-02-29 17:46   ` David MENTRE
2004-02-29 18:13     ` Nicolas Cannasse
2004-03-01  8:09       ` lehalle@miriad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).