val xml =
<foo>
<bar>hi world</bar>
<bippy>how's it going </bippy>
<inner>
<start>it's 10 am</start>
<hi>
<there/>
</hi>
</inner>
</foo>
val whitelist: Set[String] = Set("bar", "start")
def desiredFunction(whitelist: Set[String], xml: Elem): Elem = ???
desiredFunction(whitelist, xml) would evaluate to
<foo>
<bar>hi world</bar>
<bippy>NOT IN WHITELIST</bippy>
<inner>
<start>it's 10 am</start>
<hi>
<there/>
</hi>
</inner>
</foo>
scala-xml中是否已经存在这样的泛型函数?也许我可以递归地进行模式匹配?请指教。我不想使用专门针对此用例的代码。