I have the following XML:
<data>
<a>...</a>
<b1>...</b1>
<c>...</c>
<b2>...</b2>
<d>...</d>
<b3>...</b2>
</data>
In Scala, how do I extract the nodes that start with the string "b" from the data
node (i.e., Elem
object)? In this case, the desired value is a sequence of three nodes:
[<b1>...</b1>, <b2>...</b2>, <b3>...</b3]
I've tried this, but it doesn't compile:
val orderNodes: NodeSeq = /data/*[starts-with(name(), "b")]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…