I have xml that looks like this:
val xml =
<plugins>
<plugin type="x">plugin x</plugin>
<plugin type="y">plugin y</plugin>
</plugins>
I am trying to write a match
statement that finds the plugin with the attribute type="x"
. I tried:
xml match {
case <plugin type="x">{contents}</plugin> => println(contents)
case _ => println("not found")
}
but I got a syntax error on the type="x"
attribute.
Is there a way to do this match?
Thanks.