title: Transforming an XSD template to an XML instance in PHP
body: <p>I have an XSD file(s), and I need to generate a valid sample XML from that XSD file.
  For example, given the following XSD:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="Address"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element name="Recipient" type="xs:string" default="John Doe" /&gt;
          &lt;xs:element name="Street" type="xs:string" /&gt;
          &lt;xs:element name="age" type="xs:integer"/&gt;
          &lt;xs:element name="dateborn" type="xs:date"/&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>Generate the following XML:</p>
  
  <pre><code>&lt;xml&gt;
      &lt;Address&gt;
          &lt;Recipient&gt;John Doe&lt;/Recipient&gt;
          &lt;Street&gt;&lt;/Street&gt;
          &lt;age&gt;43&lt;/age&gt;
          &lt;dateborn&gt;1970-03-27&lt;/dateborn&gt;
      &lt;/Address&gt;
  &lt;/xml&gt;
  </code></pre>
  
  <p>I've searched for a solution in PHP that is capable of performing this, but only to come across two possible solutions but with no success.</p>
  
  <ol>
  <li><p>Using SDO_DAS_XML . However, this depends on tha availability of php_sdo.dll, to which there doesn't seem be a version that actually works on Windows.</p></li>
  <li><p>Second try was to look at github.com/moyarada/XSD-to-PHP or 
  forums.devshed.com/php-development-5/xml-schema-binding-to-php-code-jaxb-equivalent-199799.html
  However, these are targeted at parsing XSD and transforming to PHP classes and don't seem to be generic enoguh to transform any XSD to a simple clean XML (like above).</p></li>
  </ol>
  
  <p>Any ideas or solutions are much appreciated :)</p>
  
  <p>Thanks!</p>