I’ve been looking around the System.Xml namespace, but don’t see anything that would support this. Does anyone know if it’s built into .Net, or would I have to obtain a third party library to do it?
NOTE: I wish it were as simple as generating an xsd, but that won’t do for my specific situation.
It would be very easy to do, but very hard to make it useful.
DTD is a grammar. It is trivial to generate a grammar that generates just the given XML file and no other. This is of course useless in practice. What you probably need is to create a grammar that generates files ‘like this one’, and this is a hard AI problem.
Edit: This problem is known as ‘Grammar Induction’ or ‘Grammar Inference’.