I have object has XML as a string. For example I have a domain which has
class person{
String personId
String personName
String personType
String personDescription
String personDetailsXML
}
I am getting the details and binding to person object. I have to pass this object to another controller which displays the info about each person when he clicks on the profile name. How do i parse the XML string.
I have another domain say eachPerson domian which has
class eachPerson{
String personName
String personDescription
Object personDetails
I want to match the person name and person description and persondetailsXml.How do I do that and how can I parse personDetailsXML to personDetails object. Please suggest. How i can pass the personInstance as object to action show() in eachPerson controller??
You need to parse the xml (using introduced in the link in the comment above – or with XmlSlurper). This is pretty straightforward and easy to understand.
If you have all the data you can use
render(action:'show', controller:'eachPerson', model:[persons:personsData]). See the grails doc for further details how to userender.This will call the action with the given data. In the show action you can access it with
params.persons.