Create an xsl:text element or a text node in current template

@param  string  $content
@return DOMNode
323159
protected function createText($content)
	{
		return (trim($content) === '')
		     ? $this->createElement('xsl:text', $content)
		     : $this->ownerDocument->createTextNode($content);
	}
565629
public function write(string $content)
    {
        $body = clone $this->getBody();
        $body->write($content);
        return $this->withBody($body);
    }
449925
public function &setContent($content)
    {
        // Set element type by analyzing the element
        switch (true) {

            case ($content instanceof FormGroup):
                $this->type = 'group';
                break;

            case ($content instanceof ControlsCollectionInterface):
                $this->type = 'collection';
                break;

            case ($content instanceof AbstractForm):
                $this->type = 'control';
                break;

            case ($content instanceof AbstractHtml):
                $this->type = 'factory';
                break;

            default:
                $this->type = 'html';
        }

        $this->content = $content;

        return $content;
    }
1267849
protected function createElement($nodeName, $textContent = '')
	{
		$methodName = 'createElement';
		$args       = [$nodeName];

		// Add the text content for the new element
		if ($textContent !== '')
		{
			$args[] = htmlspecialchars($textContent, ENT_NOQUOTES, 'UTF-8');
		}

		// Handle namespaced elements
		$prefix = strstr($nodeName, ':', true);
		if ($prefix > '')
		{
			$methodName .= 'NS';
			array_unshift($args, $this->ownerDocument->lookupNamespaceURI($prefix));
		}

		return call_user_func_array([$this->ownerDocument, $methodName], $args);
	}
1209195
public function prepend($content)
    {
        $content = self::create($content);
        $newnodes = array();
        foreach ($this as $i => $node) {
            $refnode = $node->firstChild;
            /** @var \DOMNode $node */
            foreach ($content as $newnode) {
                /** @var \DOMNode $newnode */
                $newnode = static::importNewnode($newnode, $node, $i);
                if ($refnode === null) {
                    $node->appendChild($newnode);
                } else if ($refnode !== $newnode) {
                    $node->insertBefore($newnode, $refnode);
                }
                $newnodes[] = $newnode;
            }
        }
        $content->clear();
        $content->add($newnodes);
        return $this;
    }
1346747
public function appendContent($content)
    {
        if ($this->isVoid) {
            throw new Exception\RuntimeException(
                'Void elements can\'t contain content.'
            );
        }

        $this->content .= $content;

        return $this;
    }
959308
public function setInnerHtml($content)
    {
        $content = self::create($content);
        foreach ($this as $node) {
            $node->nodeValue = '';
            foreach ($content as $newnode) {
                /** @var \DOMNode $node */
                /** @var \DOMNode $newnode */
                $newnode = static::importNewnode($newnode, $node);
                $node->appendChild($newnode);
            }
        }
        return $this;
    }
909922
public function generateSearchText($content)
    {
        $content = $this->_defaultData($content);
        $content['link'] = str_replace('internal://', '', $content['link'], $count);
        if ($count > 0) {
            $paths = Path::getById($content['link']);
            $content['link'] = $paths->exists ? $paths->name : '';
        }
        return parent::generateSearchText($content['link']);
    }
575937
public static function span(
        string $content = null, 
        array $attributes = []
    ) : string 
    {
        return self::tag("span", $content, $attributes);
    }
961807
public function html($content = '')
    {
        $this->format = 'html';

        if (! str_empty($content)) {
            $this->content($content);
        }

        return $this;
    }
427645
protected function renderTag($content = null)
    {
        $attributes = $this->renderAttributes();

        if ($this->isVoid) {
            return sprintf(
                '<%1$s%2$s%3$s>',
                $this->tag,
                $attributes,
                $this->isXhtml ? ' /' : ''
            );
        }

        return sprintf(
            '<%1$s%2$s>%3$s</%1$s>',
            $this->tag,
            $attributes,
            $content
        );
    }
312047
private function createDOMDocumentFromHTML($html = null) {

        if ($html != null) {
            libxml_use_internal_errors(true);
            $dom = new DOMDocument;
            $dom->loadHTML($html);
            libxml_clear_errors();
            libxml_use_internal_errors(false);
            return $dom;
        }
    }
142934
public function appendTextContent(string $content) : Tag
    {
        if ($this->isVoid) {
            throw new \LogicException('Void elements cannot have any contents.');
        }

        $this->content .= htmlspecialchars($content, ENT_NOQUOTES | ENT_HTML5);

        return $this;
    }
1187330
public function setText($content, $charset = 'utf-8') {
        $this->text = $content;
        $this->textCharset = $charset;
        return $this;
    }
670803
public function appendHtmlContent(string $content) : Tag
    {
        if ($this->isVoid) {
            throw new \LogicException('Void elements cannot have any contents.');
        }

        $this->content .= $content;

        return $this;
    }
1144315
public static function newFromString(string $content): self
    {
        $document = Xml::newDocumentContent($content);
        // populate source since it is already available
        // in this way we avoid the conversion from document to string
        $cfdi = new self($document);
        $cfdi->source = $content;
        return $cfdi;
    }
1082141
private function loadDOMDocument($content)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->encoding = 'UTF-8';

        $dom->strictErrorChecking = false;
        $dom->substituteEntities = false;
        $dom->formatOutput = false;

        // Change mb and libxml config
        $libxmlCurrent = libxml_use_internal_errors(true);
        $mbDetectCurrent = mb_detect_order();
        mb_detect_order('ASCII,UTF-8,ISO-8859-1,windows-1252,iso-8859-15');

        $loaded = $dom->loadHTML($this->fixContentEncoding($content));

        // Restore mb and libxml config
        libxml_use_internal_errors($libxmlCurrent);
        mb_detect_order(implode(',', $mbDetectCurrent));

        if (!$loaded) {
            throw new InvalidMarkupException("Can't load the given HTML via DomDocument");
        }

        return $dom;
    }