Difference between revisions of "Function xml.escape()"

From wiki.netio-products.com
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…“)
 
 
Line 1: Line 1:
 
{{DISPLAYTITLE:function xml.escape()}}
 
{{DISPLAYTITLE:function xml.escape()}}
 
Escapes XML string to fit xml node contents.
 
Escapes XML string to fit xml node contents.
  <i>string</i> <b>xml.escape</b>(<code>xmlstring</code>)
+
  <i>string</i> <b>xml.escape</b>(<i>string</i> <code>xml</code>)
  
 
=== Parameters ===
 
=== Parameters ===
* <i>string</i> <code>xmlstring</code> string to escape
+
* <i>string</i> <code>xml</code> string to escape
  
 
=== Return value ===
 
=== Return value ===

Latest revision as of 18:19, 5 May 2017

Escapes XML string to fit xml node contents.

string xml.escape(string xml)

Parameters

  • string xml 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