Idle pondering from a Scala learner perhaps, but ... in my tinkerings I\'ve written the following:
( n.child.size > 0 ) && ( n.child.filter( ! _.isIns
you can use match for that purpose.
match
n.child match { case list => ( list.size > 0 ) && ( list.filter( ! _.isInstanceOf[Text] ).size == 0 ) }