k@sh said:
Hi All,
Does anyone have experience in converting a dtd to a random XML
template which contains no values?
Is there a way to do this in C#?
Thanks in advance...
No, but been thinking about how to do that in a nice way... It depends
on what you want. A minimal valid document? A document demonstrating som
e varieties of what is possible?
I guess one would start out the same way in all cases: Parse the DTD,
and construct a graph with a node for each declaration, and one for each
bit and piece of the regular expressions, with edges in the obvious
places. One might want to add extra edges from some nodes to their
successors, to indicate different decisions at a choice: For example, a
node representing the expression b+ could have 2 edges to the
declaration of b, one indicating "1 b child" and the other "2 b
children". Or something like it....
Then, find a traversal of the graph that uses all edges, from the
declaration of something you decide to be the root element, and re-uses
edges as few times as possible.
Nice exercise anyway.
Soren