http://www.perlmonks.org?node_id=975211


in reply to Generate XMLs from a master XML or DTD

The W3C has a Perl script that will convert a DTD to XSD. http://www.w3.org/2000/04/schema_hack/

From that XSD you could easily use XML::XPath to do parse the elements and attributes listed in the XSD and produce XML from them.