title: How to use inner loops in Apache Velocity to parse XML
body: <p>I am going to develop a eclipse plugin to generate simple Java source codes.
  Initially I need to convert a XML file to Java Class code. 
  I found Apache Velocity from internet and now I am playing with some simple stuffs.
  This is my input XML file:</p>
  
  <pre><code>&lt;?xml version= "1.0" encoding= "UTF-8" ?&gt; 
  &lt;Content&gt; 
  &lt;Class name= "Customer"  acc_modif="public"&gt; 
  &lt;attributes&gt;
   &lt;attribute attribute_type= "String" attribute_name= "studentName"  attribute_acc_modifer="public"/&gt; 
   &lt;attribute attribute_type= "int"  attribute_name= "age"  attribute_acc_modifer="public"/&gt; 
  &lt;/attributes&gt;
  
  &lt;constructors&gt;
      &lt;constructor con_acc_modifer="public" con_name="Student"&gt;
  
              &lt;para para_type="String" para_name="studentName"/&gt;
              &lt;para para_type="int" para_name="age"/&gt;
      &lt;/constructor&gt;
  
      &lt;constructor con_acc_modifer="public" con_name="Student"&gt;
  
              &lt;para para_type="String" para_name="studentName"/&gt;
              &lt;para para_type="int" para_name="age"/&gt;
  
      &lt;/constructor&gt;
  &lt;/constructors&gt;
  &lt;/Class&gt; 
  
  &lt;/Content&gt;
  </code></pre>
  
  <p>And this is my template file:</p>
  
  <pre><code>## class .vm 
  ##apachi-3
  
  import java.util.*; 
  
  $class.acc_modif class $class.name { 
  
  #foreach ( $att in $class.attributes ) 
     $att.attribute_acc_modifer $att.attribute_type $att.attribute_name; 
  #end
  
  #foreach ( $con in $class.constructors ) 
     $con.con_acc_modifer $con.con_name ( $con.para_type $con.para_name ) { ## Not working :(
  }       
  #end 
  }
  </code></pre>
  
  <p>And the output was like this:</p>
  
  <pre><code>import java.util.*; 
  
  public class Customer { 
  
  public String studentName; 
  public int age; 
  
  public Student ( $con.para_type $con.para_name ) {   }       
  public Student ( $con.para_type $con.para_name ) {   }       
  
  }
  </code></pre>
  
  <p>Student constructors are not working. I think I need to use another loop inside brackets instead of <strong>"$con.para_type $con.para_name"</strong>
  But I don't know how to use another loop here (i am a noob of Apache Velocity).<br>
  Velocity Gurus please help me!</p>