Helma logo
helma.org » Home > Stories > encodeXml()

encodeXml()

Prepares a string for smooth XML output.

This function substitutes the characters '<', '>', '&', as well as single and double quotes with their predefined XML 1.0 entities. Additionally, some characters that are illegal in XML documents are silently dropped.

encodeXml() is usually used to encode text for safe inclusion in parsed character data sections of XML documents.

Syntax
encodeXml(String)

Example
var str = encodeXml("<title>Smørebr&oslash:d</title>");
res.write(str);
&lt;title&gt;Smørebr&amp;oslash:d&lt;/title&gt;


... comment


Page last modified on 2003-08-19 17:48 by czv