Difference between revisions of "Function xml.escape()"
Jump to navigation
Jump to search
(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…“) |
(No difference)
|
Revision as of 14:56, 21 April 2017
Escapes XML string to fit xml node contents.
string xml.escape(xmlstring)
Parameters
- string
xmlstringstring to escape
Return value
string
Escaped characters are
| input | output |
|---|---|
| < | < |
| > | > |
| " | " |
| ' | ' |
| & | & |
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)