Reputation: 8245
I'm trying to access the child nodes of some XML that looks a bit like this:
<msgGrp>
<msg>a</msg>
<msg>b</msg>
<x>c</x>
<y>d</y>
<msg>e</msg>
<msgGrp>
As you can see, there can be any number of "msg" elements, and exactly one of all of the other kinds of things. I wanted to write a function to grab the msg elements only, and then grab the non-msg elements only. I came up with something like this:
val messages = n \ "msg"
val non_mesages = (n \ "_").filter(_.label != "msg")
But is there a more concise way of saying "any message where the label isn't 'msg'"?
Upvotes: 0
Views: 112