Possible Duplicate:
Import XML into a Grails Domain Class
say am having the xml file like below,
Now i want to insert these firstname, deptname and empid into the database using grails
can anyone suggest an idea in this.
<employees>
<employee>
<firstname>Marios</firstname>
<deptname>ITdepartment</deptname>
<empid>123</empid>
</employee>
<employee>
<firstname>Ben</firstname>
<deptname>Management</deptname>
<empid>124</empid>
</employee>
</employees>
Thank you all, I got the answer how to do that am posting here for others for their knowledge if changes required any can suggest me
def Employee = new XmlParser().parse("Your Xml file path")def set1 = sql.dataSet("Your field name in Xml")Employee.employee.each {def firstname = it.firstname.text()def deptname = it.deptname.text()def empid = it.empid.text()set1.add(first_name:firstname,dept_name:deptname,emp_id:empid)}