this works:
<a>apple</a>
node match {
case <a>{contents}</a> => "It's an a: "+ contents
case _ => "It's something else."
}
how can i modifiy this example, so that it only matches a node with a tag “a” and attribute id=2:
something as follows:
<a id="2">apple</a>
node match {
case <a id="2">{contents}</a> => "It's an a: "+ contents
case _ => "It's something else."
}
but this does not compile.
Here is one way to do it: