title: Ampersands not being processed in scala xml
body: <p>Im creating an XML replacement utility which will replace an attribute in an XML file. But for some reason if the attribute I'm trying to replace contains an ampersand, it doesn't get processed properly by a boolean method (isreplacementEntry) I wrote. My code is as follows</p>
  
  <pre><code>  /**
     * This method is used to iterate over the entirety of the xml presented and modify the XML attribute desired while
     * keeping old XML values
     * @param elem the XML you pass in (generally from file, input stream or string)
     * @param attrName name of the attribute you want to replace
     * @param curVal value of the current attribute
     * @return
     */
    def replaceXMLEntryAttribute(elem: Elem, attrName: String, curVal: String, desiredVal: String): Node = {
      def replace: Node =&gt; Node =
      {
        case e: Elem if isReplacementEntry(e, attrName, curVal) ⇒ generateReplacementXMLAttribute(e)
        case e: Elem ⇒ e.copy(
          child = e.child.map { replace(_) }
        )
        case other⇒ other
      }
  
      def generateReplacementXMLAttribute(node: Elem): Elem = {
        println("gets here")
        val currentXML= node.toString()
        val newAttr= currentXML.replaceAllLiterally("\""+curVal, "\""+desiredVal)
  
        XML.loadString(newAttr)
  
      }
      replace(elem)
    }
  
    /**
     * This method checks whether
     * @param node  The elements from which you wish to check if such an attribute exists
     * @param attributeName The name of the attribute to modify
     * @param currentAttrValue The current value of thr attribute that will eventually be modified
     * @return
     */
    private def isReplacementEntry(node: Elem, attributeName: String,  currentAttrValue: String): Boolean = {
    /*  val test = node.mkString)
      println(test)*/
      val attr = "@" + attributeName
      val exists = node \\ attr find { _.text == currentAttrValue }
      exists match{
        case None =&gt; false
        case _ =&gt; true
      }
    }
  </code></pre>
  
  <p>Specifically, this line  <code>val exists = node \\ attr find { _.text == currentAttrValue }</code> always returns false. Something I tried was using scala.xml.Utility.escape with current Attr Value but it still doesnt seem to work.</p>
  
  <p>Sample XML this should work with is </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;Stuff expression="test"&gt;
  &lt;Rule expression="threshold &amp;lt;= 20 AND '${userID}' IN ('USER1','USER2','USER_7','USER_09')"/&gt;
  &lt;/Stuff&gt;
  </code></pre>
  
  <p>where I'm trying to replace the line with Rule</p>