Govind Singh
Govind Singh

Reputation: 15490

Dealing with xml in Scala play framework

In views folder kq.xml:

@(code:String)
<Response>
    <Say voice="alice">
        welcome
    </Say>
    <Pause  length="1"/>
    <Say loop="6" voice="alice" >
         your conformation code is
        <Pause  length="1"/>
            @code
    </Say>  
</Response>

In controller:

 def kqxml(code:String) = Action { implicit request =>
   try {
      Ok(views.xml.kq(code))
   } catch {
      case e: Exception =>
        Ok(write(Map("result" -> "error")))
   }
}

But getting error:

 object kq is not a member of package views.xml
[error]           Ok(views.xml.kq(code))
                               ^

I also tried:

Ok(views.html.kq(code))

which of course didn't work.

Upvotes: 0

Views: 428

Answers (1)

myborobudur
myborobudur

Reputation: 4435

Do XML templates really exist? I always just used HTML.

But my guess is your template file needs to be called xyz.scala.xml, so: If you are in the root template directory views you should have a file called kq.scala.xml, and then you should be able to write Ok(views.xml.kq(code)).

Upvotes: 1

Related Questions