function xml.escape()

From wiki.netio-products.com
Revision as of 14:56, 21 April 2017 by Jturon (talk | contribs) (Založena nová stránka s textem „{{DISPLAYTITLE:function xml.escape()}} Escapes XML string to fit xml node contents. <i>string</i> <b>xml.escape</b>(<code>xmlstring</code>) === Parameter…“)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Escapes XML string to fit xml node contents.

string xml.escape(xmlstring)

Parameters

  • string xmlstring string to escape

Return value

string

Escaped characters are

input output
< &lt;
> &gt;
" &quot;
' &apos;
& &amp;

Usage

-- escape string
local note = xml.escape("3<5")
-- put the escaped string "3<5" into xml node
local node = "<note>"..note.."</note>"
-- parse the node
local result = xml.parse(node)
-- check the contents (text is unescaped: "3<5")
log(result.text)

See also