Is there an easy way to go from the Ocaml data type to the corresponding xml view?
Suppose I have the following types:
type A =
| FirstA of B list
| SecondA of C * string
type B = B1 | B2
type C = {
my_field: int;
}
For value, SecondA (C {my_field=10}, "just a value")I would like to get maybe something like this:
<A constructor="FirstA">
<C><my_field>10</my_field></C>
<string>just a value</string>
</A>
Is there a library that can do something like this? Or, if I need to do this myself, what would be the best approach? Note that I want to apply this to several different data types.
I am familiar with general data type programming methods, but they are too "heavy" to use in my case.
Calin source
share