I know of no Perl module that generates an XML document based on an input XSD. There are tools available that do it however (Google;-). I myself use XMLSpy for that. See below for an example generated with XMLSpy (runs under Windows only). Look for oXygen for a platform independent solution, it's cheap and good and has an "XML Instance Generator" too.

<?xml version="1.0" encoding="UTF-8"?> <!--Sample XML file generated by XMLSPY v2004 rel. 4 U (http://www.xml +spy.com)--> <bks:books xmlns:bks="urn:books" xmlns:xsi="http://www.w3.org/2001/XML +Schema-instance" xsi:schemaLocation="urn:books theSchema.xsd"> <book id="String"> <author>String</author> <title>String</title> <genre>String</genre> <price>3.14159</price> <pub_date>1967-08-13</pub_date> <review>String</review> </book> </bks:books>

The XML file you give is not valid by the way. Error message: "Mandatory ‘pub_date’ element expected in place of ‘review’."

There are many Perl modules to work with XML. With some effort you can write a Perl script that generates a valid XML file out of an XSD.

HTH

UPDATE
Some XIGs (XML Instance Generators):


In reply to Re^3: How to generate XML file from XSDs ? by dHarry
in thread How to generate XML file from XSDs ? by matrixmadhan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.