scala xml difference between \ and \\ methods



I have the following scala xml code sample:


val validTokenXmlWithPaypalType = <paymentMethod> <paymentToken> <token type="PAYPAL_PAYMENT">testToken</token> </paymentToken> </paymentMethod>


when I try to access the type attribute using:



(paymentMethodElem \ "paymentToken" \ "@type").text


It's returning an empty string.


I tried it this way and its work:



(paymentMethodElem \ "paymentToken" \\ "@type").text


can someone please explain the difference between "\\" and "\" methods?


No comments:

Post a Comment