System:Xml:encode for xml

From Aspen Documentation

Encodes strings for using in an xml document. If using DOMDocument, this function is not needed.

Since 1.0

Arguments

string encode_for_xml (string $string)

string
A string to encode for use in XML.

Returns

Returns a string.


Examples

For example, an ampersand must be encoded when passing to xml but there are issues presented when simply using htmlentities. The below function:

$this->APP->xml->encode_for_xml('Testing & testing & output.');

Will return:

Testing & testing & output.