wrote:
> A script to do this would be amazing, if you're interested in doing it.
I just had a look at the DTD generator script again.
It looks like the script already does what you want.
On my RedHat Linux for example, I did this to generate
a DTD which covers all the files whose names are passed
on the command line:
gawk -f dtd_generator.awk /usr/share/doc/libxml2-devel-2.6.10/examples/test*.xml
<!ELEMENT doc ( dest | src | parent )* >
<!ELEMENT dest ( #PCDATA ) >
<!ATTLIST dest id CDATA #REQUIRED>
<!ELEMENT src ( #PCDATA ) >
<!ATTLIST src ref CDATA #REQUIRED>
<!ELEMENT parent ( discarded | preserved )* >
<!ELEMENT discarded ( discarded )* >
<!ELEMENT preserved ( child2 | preserved | child1 )* >
<!ELEMENT child2 ( #PCDATA ) >
<!ELEMENT child1 ( #PCDATA ) >
I guess that's what you wanted.
Such a DTD is far from perfect of course.
You should take it as a starting point, rearrange
the sequence of lines and insert comments from your
original (much larger) DTD.