title: Creating HTML form using XML to define layout C#
body: <p>I have some XML in the following schema:</p>
  
  <pre><code>&lt;Form ID="1" Formtitle="Title"&gt;
      &lt;Fields&gt;
              &lt;Fieldset Legend="LegendText" &gt;
                  &lt;Field FieldName="Field1" Label="Title" Type="Text" Required="1" /&gt;
                  &lt;Field FieldName="Field2" Label="Radio" Type="Radio" Required="0"&gt;
                      &lt;Option Value="1" Text="Just One"/&gt;
                      &lt;Option Value="2" Text="Maybe Two"/&gt;
                  &lt;/Field&gt;
              &lt;/Fieldset&gt;
      &lt;/Fields&gt;
  &lt;/Form&gt;
  </code></pre>
  
  <p>I need to parse through this in C# to generate a HTML form that would represent the following:</p>
  
  <pre><code>&lt;h1&gt;Formtitle&lt;/h1&gt;
  &lt;form id="1" action="myurl.com"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;LegendText&lt;/legend&gt;
          &lt;label&gt;Title&lt;/label&gt;
          &lt;input type="text" name="Field1" class="jqueryValidate"/&gt;
          &lt;!-- jqueryvalidate class added as required is equal to 1 in XML --&gt;
          &lt;label&gt;Radio&lt;/label&gt;
          &lt;input type="radio" name="Field2" Value="1"/&gt; Just One
          &lt;input type="radio" name="Field2" Value="2"/&gt; Maybe Two
      &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now, I am aware that I can achieve the same kind of thing using XSLT, however I must use C# here as I will be wrapping this up into a control that I can drop in to any of my pages.</p>
  
  <p>My question is, how could I acheive something like this? I envisage it requiring some type of nested switch statements to check node names and types etc, and stringbuilding the HTML. But, I'm hoping this isn't the case, and you boffins can help point me in the right direction with this.</p>
  
  <p>Thanks in advance :)</p>
  
  <p>Dave</p>