小编cak*_*e3d的帖子

使用命名空间访问XML属性

如何使用命名空间访问属性?我的XML数据是一种形式

val d = <z:Attachment rdf:about="#item_1"></z:Attachment>
Run Code Online (Sandbox Code Playgroud)

但以下内容与属性不匹配

(d \\ "Attachment" \ "@about").toString
Run Code Online (Sandbox Code Playgroud)

如果我从属性的名称中删除命名空间组件,那么它可以工作.

val d = <z:Attachment about="#item_1"></z:Attachment>
(d \\ "Attachment" \ "@about").toString
Run Code Online (Sandbox Code Playgroud)

知道如何在Scala中使用命名空间访问属性吗?

xml parsing scala

10
推荐指数
2
解决办法
2158
查看次数

标签 统计

parsing ×1

scala ×1

xml ×1