Suppose I am writing a function (Node, String) => Option[String] to get attribute value by attribute name from a given node.
def getAttributeValue(node: Node, attributeName: String): Option[String] = {
val txt = (node \ ("@" + attributeName)).text
if (txt.isEmpty) None else Some(txt)
}
Does it make sense ? How would you fix/improve it ?