Escaping string variable for selector

If you are using dynamic selectors, it’s a good idea to escape the value to handle XML special characters. If you don’t, and a special character is in the variable’s value, you will see an error like this:

Value for property [Target.Strict selector] is not a valid XML syntax.

There is a very simple way to XML escape the value.

SecurityElement.Escape(yourStringVar)

2 Likes

Thanks, this helped me!

1 Like