yaswanth.14 has asked for the wisdom of the Perl Monks concerning the following question:

I need to generate test XMLs(valid & invalid ones) from a master XML or DTD.

Here is the sample DTD & master XML.
<?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body> </note>

When it comes to good XMLs, i need to generate them with different data that i have from Oracle database. In case of negative tests I need to generate XML which are not strict to my DTD. Please give me some suggestions.

Replies are listed 'Best First'.
Re: Generate XMLs from a master XML or DTD
by jdrago999 (Pilgrim) on Jun 08, 2012 at 17:40 UTC
Re: Generate XMLs from a master XML or DTD
by thomas895 (Deacon) on Jun 07, 2012 at 05:39 UTC

    Welome to PerlMonks! :-)
    When posting a question, be sure to read How do I post a question effectively? first. What have you tried? We can't just "suggest something", as there are many ways of "generating an xml dtd", each being a little different.

    In order to get more useful answers, you'll need to be a bit more specific, I'm afraid.

    ~Thomas~
    confess( "I offer no guarantees on my code." );
Re: Generate XMLs from a master XML or DTD
by Jenda (Abbot) on Jun 09, 2012 at 01:36 UTC

    You may want to have a look at XML::Compile. Once you convert your DTD to a schema, this module (according to the docs ... if I understand them correctly) should help you produce XMLs according to the schema.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.