I\'m writing a tool to update some xml files (pom.xml in this case) with scala because the effort it would take in java is significantly higher than (in theory) it is with s
Text is represented as a Node
inside of the Element
s Node. So a bit of functional recursion will let you do a deep copy & filter:
def deepCopy(node:Node) : Node = node match {
case e : Elem => e.copy(child = this.child.toSeq.map(deepCopy))
case t : Text => new Text(t.text.split("-").head)
case x => x
}
disclaimer: this code was not tested for errors