iXperion provides a number of vipers for encoding XML attribute values. A number of characters are not allowed in XML attributes values and the vipers EncodeQuotes and EncodeAttribute ensure those characters are correctly encoded.
EncodeQuotes only encodes single and double quotes, while EncodeAttribute encodes not only single and double quotes, but also encodes are removes entire xml element tags.
EncodeQuotes
The viper string.encodequotes is typically used to encode xml attribute values. Xml attribute values are enclosed by either single (') or double (") quotes. Because of this an XML attribute value cannot contain quotes. Technically it's possible to use single quotes when double quotes are used as enclosure and vice versa, but to be on the safe side it's generally wise to encode both single and double quotes when writing XML attribute values.
A single quote is encoded as numeric entity ' (Internet Explorer doesn't handle the named entity ' well) and the double quote is encoded as named entity ".
EncodeAttribute
Encodes quotes as described above. XML attribute values cannot contain XML element tags. In order to prevent those tags the < and > are encoded or removed entirely. You can specify your preference with the viper overload string.encodeattribute(data, removeTags). The default removes the tags as you can see in the example.
Which one?
EncodeQuotes or EncodeAttribute? It entirely depends on the input you expect. If you are certain the value does not contain XML element tags, you can use EncodeQuotes. If you are unsure use EncodeAttribute.