【问题标题】:Rendering XML response on Grails problem在 Grails 问题上呈现 XML 响应
【发布时间】:2010-01-14 15:03:40
【问题描述】:

我在将通过 XMLSlurper 解析的 XML 文件渲染为 XML 变量时遇到问题。 下面是我的代码。

def userFile =new File("test.xml") def xml= new XmlSlurper().parse(userFile)

渲染 xml

问题是我看不到 xml 被渲染到我的 flex 应用程序中。

【问题讨论】:

    标签: xml grails render xmlslurper


    【解决方案1】:

    如果你只是想渲染 xml 文件你可以说:

        def xmlFile = new File("test.xml")
        response.contentType = "text/xml"
        response.outputStream << xmlFile.text
    

    而且根本不需要啜饮者

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-28
      • 1970-01-01
      • 1970-01-01
      • 2018-03-07
      • 1970-01-01
      相关资源
      最近更新 更多