Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Groovy
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Groovy
Reading from XML and storing the values in database
Sabarish Venkat
Ranch Hand
Posts: 136
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all, say am having an xml file like 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>
Now i want to insert these firstname, deptname and empid into the database using grails
can anyone suggest an idea in this.
Sabarish Venkat
Ranch Hand
Posts: 136
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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) }
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Urgent : help needed is XSLT
Mapping Error Hibernate
Problem with refresh() method of EntityManamger in JPA
Writing linked list to an XML file.
How to get a XPath and X-query with the XML document
More...