【发布时间】:2017-06-23 18:46:12
【问题描述】:
我正在向 URL 发出请求以获取 RSS xml 数据:
val items: List[Item] = ws.url("http://www.example.com/rss.xml").get().map { response =>
}
现在我想遍历所有节点并创建一个项目集合。
我的物品箱类是:
case class Item(title: String, link: String, description: String, guid: String)
XML 格式如下:
<rss ...>
<channel>
<title>
</title>
<link />
<description />
<item>
<title>hello</title>
<description> ... </description>
<guid> ... </guid>
</item>
<item>
...
</item>
</channel>
</rss>
我不确定如何处理调用 .map 以遍历项目的响应以及如何返回项目案例类的集合。
【问题讨论】:
-
你查看官方文档了吗:playframework.com/documentation/2.5.x/…。这是另一个可以使用 xml 的资源:@987654322@
标签: scala playframework