I have the following xml- node:
val xml = <fields><field name="one"></field><field name="two"></field></fields>
Now I would like to create a Map [String, Node] with the field name as the key.
for{x <- xml \ "field"} yield Map(x \ "@name" -> x)
Using the output above, I get a list of maps, though:
List(Map((one,<field name="one"></field>)), Map((two,<field name="two"></field>)))
How can I functionally get the [String, Node] map without switching to the imperative mode (temp-vars) to convert the Maps in the List to the final desired map, possibly without a lesson?
source
share