<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/5a06bc8279f4c19275cafe9ac3e9a815"
  from="Hendrik Tews &lt;tews@t...&gt;"
  author="Hendrik Tews"
  date="2006-02-28T15:23:41"
  subject="xml tree -- variant type tree"
  prev="2006/02/14a9c4cad7029f82e8818777b3f1896f"
  next="2006/02/e04c8ab1b293d8f49f5190b5f9c16d87"
  next-in-thread="2006/02/e04c8ab1b293d8f49f5190b5f9c16d87"
  prev-thread="2006/02/14a9c4cad7029f82e8818777b3f1896f"
  next-thread="2006/03/fc201eb3f71302cddcd6cdeba8f38433"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="xml tree -- variant type tree">
<msg 
  url="2006/02/5a06bc8279f4c19275cafe9ac3e9a815"
  from="Hendrik Tews &lt;tews@t...&gt;"
  author="Hendrik Tews"
  date="2006-02-28T15:23:41"
  subject="xml tree -- variant type tree">
<msg 
  url="2006/02/e04c8ab1b293d8f49f5190b5f9c16d87"
  from="Michael Wohlwend &lt;micha-1@f...&gt;"
  author="Michael Wohlwend"
  date="2006-02-28T15:42:54"
  subject="Re: [Caml-list] xml tree -- variant type tree">
<msg 
  url="2006/02/9be4a9513b06eceb470e19b33ee11f97"
  from="Alain Frisch &lt;Alain.Frisch@i...&gt;"
  author="Alain Frisch"
  date="2006-02-28T15:52:40"
  subject="Re: [Caml-list] xml tree -- variant type tree">
</msg>
</msg>
<msg 
  url="2006/02/810a676239033685940f34f8c4924ab8"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2006-02-28T15:47:56"
  subject="Re: [Caml-list] xml tree -- variant type tree">
<msg 
  url="2006/02/54236ddfa0181dd7019024f192ea7fdd"
  from="Michael Wohlwend &lt;micha-1@f...&gt;"
  author="Michael Wohlwend"
  date="2006-02-28T15:56:56"
  subject="Re: [Caml-list] xml tree -- variant type tree">
<msg 
  url="2006/02/b7334ae50cf879e74b8b9faf0252e31b"
  from="Alain Frisch &lt;Alain.Frisch@i...&gt;"
  author="Alain Frisch"
  date="2006-02-28T16:24:49"
  subject="Re: [Caml-list] xml tree -- variant type tree">
<msg 
  url="2006/02/406082980351bed8ed58171fa77ef569"
  from="Michael Wohlwend &lt;micha-1@f...&gt;"
  author="Michael Wohlwend"
  date="2006-02-28T18:11:18"
  subject="Re: [Caml-list] xml tree -- variant type tree">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2006/02/6af59d175cbc1504e985c3969a204017"
  from="philip &lt;philip-f@w...&gt;"
  author="philip"
  date="2006-02-28T20:56:48"
  subject="Re: [Caml-list] xml tree -- variant type tree">
</msg>
</msg>
</thread>

<contents>
Hi,

I would like to read an XML file into an element of some variant
type, where each constructor corresponds to precisely one type of
xml nodes. Of course I would need to define the variant type
beforehand. But how to proceed then?

The humps give me the impression that the right library to use is
Gerd Stolpmanns pxp. However, this library will produce an object
tree, which I could probably convert into a variant type with
some effort. 

An alternative would be to use XML-Light, which produces string
labelled trees, and to translate these string trees myself.

Is there some better solution?


Background: I would like to manipulate abstract syntax trees of
C++ programs. I couldn't find a C++ parser in Ocaml, therefore I
would like to use Elkhound/Elsa
(http://www.cs.berkeley.edu/~smcpeak/elkhound/), which can output
the abstract syntax tree as xml file. Extending Elsa is not an
option, because for ast manipulations I prefer ocaml pattern
matching over C++ visitors.

Bye,

Hendrik

</contents>

</message>

