Reputation: 3246
I am sending XML(text/xml)
content-type and in Controller is getting String as
`AnyContentAsXml(<SomeTag>....</SomeTag>)`
which should be like
'<?xml version='1.0' encoding='UTF-8'?><SomeTag>....</SomeTag>`
So how I can convert AnyContentAsXml
to XML string?
Upvotes: 0
Views: 137
Reputation: 1226
Play has a builtin xml body parser, you can use like
def someendpoint = Action(parse.xml) { request =>
val elementOpt = request.body \\ "someelement" headOption
}
notice that, request.body
is a NodeSeq
and can be used to do any xml releated thing.
Upvotes: 1