Annyce Davis

ones and zeros

  • Home
  • Public Speaking
  • About Me
  • Courses
  • Life

Rendering XML from a Grails Controller

June 9, 2009 by Annyce Davis Leave a Comment

I have been trying to render a simple XML file from a Grails Controller and I’ve found tons of blogs that provided the most complicated examples or examples that were too basic. After much tinkering around this is the code that will generate an XML file in the following format based on the items contained in the list.

<resultset>
<result>happy</result>
<result>sad</result>
<result>angry</result>
</resultset>
inside the Controller action...
def finalList = ['happy', 'sad', 'angry']

render(contentType: 'application/xml') {
resultSet(){
finalList.each { item ->
result(item)
}
}
}

Follow Me

Each year there's a new version of the Android SDK released. Along with the myriad of new features come deprecations. When something is deprecated, although … [Read More...]

I didn't intentionally aim to create a rhyming title, but there you have it. Each year, I look forward to Google I/O like a kid going back to school. This year … [Read More...]

Categories

  • Android (56)
  • Career (2)
  • Communication (4)
  • Flutter (1)
  • Git (4)
  • Gradle (4)
  • Grails (23)
  • Java (8)
  • JavaScript (6)
  • Kotlin (17)
  • Life (4)
  • Public Speaking (24)
  • RxJava (1)
  • Software Development (8)
  • Twitter (3)
  • Uncategorized (11)
  • Video Course (5)

Follow Me

Archives

Categories

Copyright © 2023 · Beautiful Pro Theme on Genesis Framework · WordPress · Log in