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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |