title: Java: write XML according to user defined XSD
body: <p>I'm writing a tool to transform CSV formatted data into XML. The user will specify the parsing method and that is: the XSD for the output, which field in the CSV goes in which field of the resulting XML.</p>
  
  <p>(very simplified use-case) Example:</p>
  
  <p>CSV</p>
  
  <pre><code>Ciccio;Pippo;Pappo
  1;2;3
  </code></pre>
  
  <p>XSD</p>
  
  <pre><code>(more stuff...)
  &lt;xs:element name="onetwo"&gt;
  &lt;xs:element name="three"&gt;
  &lt;xs:element name="four"&gt;
  </code></pre>
  
  <p>USER GIVES RULES</p>
  
  <pre><code>   Ciccio -&gt; onetwo
     Pippo -&gt; three
     Pappo -&gt; four
  </code></pre>
  
  <p>I've implemented this in C# using Dataset, how could I do it in Java? I know there's DOM, JAXB etc. but it seems XSD is only used to validate an otherwise created XML. Am I wrong?</p>
  
  <p>Edit:
  Everything needs to be at runtime. I don't know what kind of XSD I'll receive so I cannot instantiate objects that don't exist nor populate them with data. So I'm guessing the xjc is not an option.</p>