Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implicit val NodeSeqUnmarshaller = new Unmarshaller[NodeSeq] {
- def apply(entity: HttpEntity) = Right {
- entity match {
- case HttpEntity.NonEmpty(contentType, data) ⇒
- val parser = XML.parser
- try {
- parser.setProperty("http://apache.org/xml/properties/locale", java.util.Locale.ROOT)
- } catch {
- case e: org.xml.sax.SAXNotRecognizedException ⇒ // property is not needed
- }
- XML.withSAXParser(parser).load(new InputStreamReader(new ByteArrayInputStream(data.toByteArray), contentType.charset.nioCharset))
- case HttpEntity.Empty ⇒ NodeSeq.Empty
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement