Quantcast

Displaying Relational XML in a Browser

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Displaying Relational XML in a Browser

jpalmer1026
I realize this is an odd question but I'm wondering if there is a way to render XML stored in a database to the browser. The app I'm working on has file uploading capabilities allowing xml files to be uploaded as BLOB types (don't ask) but I'm unsure as to how I can write this data to the browser. I created a renderXml action as shown below, but I'm having trouble displaying the XML in the browser. Can this be done?

def renderXml = {
    def fraudConfigurationInstance = FraudConfiguration.findById(1)
    if (fraudConfigurationInstance?.xml) {
      response.setContentLength(fraudConfigurationInstance.xml.length)
      response.outputStream.write(fraudConfigurationInstance.xml)
    } else {
      response.sendError(404)
    }
  }
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying Relational XML in a Browser

Konstantyn Smirnov
I would try

groovy.xml.XmlUtil.serialize fraudConfigurationInstance.xml, response.outputStream
Loading...