Encodes a string for safe output within an XML attribute. Use encodeForXML when outputting a variable inside a XML tag body.
encodeForXMLAttribute(string inputString, boolean canonicalize);
→ returns string
false
true
the canonicalize function is called before encoding the input. If set to false, the given input string will just be encoded, both mixed and multiple encodings will be allowed.
true
false
canonicalize
argument.
Encodes the single quote into an XML entity.
encodeForXMLAttribute("It's for use in attribute values")
Expected Result: It's for use in attribute values