Question

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.

Was it helpful?

Solution

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".

OTHER TIPS

I'm not sure about DTD but you can generate XSD files from an xml file using the Xsd.exe tool. It usually lives in the following directory:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\xsd.exe

Well, xsd.exe should be able to get you an xsd. For the dtd side, xmlpad3 claims to be able to do this (and is free). I haven't tried, so I can't vouch for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top