Index

XmlText

MMO\core\helpers · 1 symbol · generated 30 Sep 2026

class

XmlText

XmlText.php:17

A text node of an XmlNodes tree. A string a node holds is markup, printed as it is (new XmlNode('p', [], ['<b>hi</b>']) shows a bold "hi"); an XmlText is text, escaped when it is printed. Hold in one what must not be read as markup: what a user wrote, a page's title (HtmlDocument::setTitle). It is escaped once, also in a document that escapes the strings it prints (the escape option), and is valid in XML too.

class MMO\core\helpers\XmlText implements MMO\core\interfaces\iRenderable
Namespace
MMO\core\helpers
Implements
iRenderable
$p = new XmlNode('p', [], [new XmlText('1 < 2 & <b>')]); (string)$p; // '<p>1 &lt; 2 &amp; &lt;b&gt;</p>' $p->innerText(); // '1 < 2 & <b>'

Properties1

text

readonly
readonly string $text
Type
string

Methods5

render($opts)

XmlText.php:27
function render(array $opts = []): string
$opts = []array
returnsstringthe text, escaped: <, >, & and the quotes as entities

__construct($text)

XmlText.php:19
function __construct(string $text)
$textstringthe text itself, unescaped