title: How can i create a xml document based on a schema using php?
body: <p>I want to create a xml file from the data given by the users.</p>
  
  <p>I can use simplexml or DOMDocument for creating xml files and even there is an option in DOMDocument to verify the xml document with a schema .</p>
  
  <p><strong>But what i need is instead of creating nodes and adding values using xml classes, can i create a xml file from the data stored somewhere else in respect with a schema?</strong></p>
  
  <p>I think in .net there is an option to write into xml from reading from dataset.. But i couldn't find such thing in PHP.</p>
  
  <p>Is that possible and are there any classes for that?</p>
  
  <p>If there are no predefined classes , at least any help on any ways of doing that?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I'm editing this question because it seems that some of you is not clear about my requirement..</p>
  
  <p>For example, if the schema is </p>
  
  <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  attributeFormDefault="unqualified"&gt;
  &lt;xs:element name="formpatterns"&gt;
  &lt;xs:element name="pan" type="pantype"/&gt;
  &lt;xs:element name="name" type="nametype"/&gt;
  &lt;xs:element name="fatherName" type="nametype"/&gt;
  &lt;xs:group ref="address"/&gt;
  &lt;xs:element name="dob" type="xs:date"/&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>and if user gives the data for pan, name, fathername, address, dob then
  i need to create the xml document automatically by matching the schema and data.</p>
  
  <p>The schema may change from time to time , so i dont want to edit all the code to create/ change nodes and attributes. I need just to point the new schema , so that the code creates the xml based on that.</p>