There are basically two ways to reliably handle this situation.
The first way is to define a VariableContext
and put the value you want to use in an XPath variable. Then you can use an expression like:
//somePath/FieldData[@Location = $user]/@Value
I describe how to do that in this post. It requires creating a VariableContext
class as nothing suitable is built into .NET, but the example I provide should work as-is for most cases.
The other option is to use Linq-to-XML. If you go that route, you can query the node using Linq instead of XPath and delimiters are not an issue this way:
// here the doc variable is an XElement or XDocument
var value = (from fd in doc.Descendants("FieldData")
where (string)fd.Attribute("Location") == sUser
select fd.Attribute("Value")).FirstOrDefault();
or with the other Linq syntax:
var value = doc.Descendants("FieldData")
.Where(fd => (string)fd.Attribute("Location") == sUser)
.Select(fd => fd.Attribute("Value"))
.FirstOrDefault();