Consider the following XML node:
<Interval>
<P v="1"/>
<Q v="0.0"/>
</Interval>
What is the correct way to pattern match the top level element in Scala? I would expect the following to work but it does not:
def visit(node:Node):String = {
node match {
case p @ <P/> => (p \ "@v") text
case q @ <Q/> => (q \ "@v") text
case <Interval> @ children:_* </Interval> => "parent"
}
}