Add CDATA text in a node
@param string $cdata_text The CDATA value  to add
349673
protected function addCData($cdata_text)
    {
        $node = dom_import_simplexml($this);
        $no = $node->ownerDocument;
        $node->appendChild($no->createCDATASection($cdata_text));
    }
535418
public function writeCData($value)
    {
        if (is_array($value)) {
            foreach ($value as $attrValue) {
                $this->context->writeCData($attrValue);
            }
        } else {
            $this->context->writeCData($value);
        }
    }
48180
def _add_text(self, text):
        
        if text:
            if self.pending_nodes:
                self.pending_nodes[-1].append(nodes.Text(text))
            else:
                self.new_nodes.append(nodes.Text(text))
1137692
public function writeElement(
            string $elementName,
            array $attributes = [],
            string $cdata     = null
    ): XmlStreamWriter {
        return $this->append(
                function(\DOMNode $parent) use ($elementName, $attributes, $cdata)
                {
                    $element = $this->doc->createElement($elementName);
                    foreach ($attributes as $name => $value) {
                        $element->setAttribute($name, $this->encode($value));
                    }

                    if (null !== $cdata) {
                        $element->appendChild($this->doc->createTextNode($this->encode($cdata)));
                    }

                    $parent->appendChild($element);
                },
                'element: "' . $elementName . '"'
        );
    }
1180851
public function addCDATASection($content)
    {
        switch (true) {
            case is_string($content):
                break;
            case ($content instanceof \SimpleXMLElement):
                $dom = dom_import_simplexml($content);
                $content = $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
                break;
            case ($content instanceof \DOMDocument):
                $content = $content->saveXML($content->childNodes->item(0));
                break;
            case ($content instanceof \DOMNode):
                $dom = new \DOMDocument();
                $import = $dom->importNode($content, true);
                $dom->appendChild($import);
                $content = $dom->saveXML($dom->firstChild);
                break;
            default:
                throw new \InvalidArgumentException(
                    sprintf(
                        'expected arguement 1 to be String, SimpleXMLElement, DOMNode, or DOMDocument, instead saw %s',
                        gettype($content)
                    )
                );
        }

        $import = dom_import_simplexml($this);
        $node   = $import->ownerDocument;
        $import->appendChild($node->createCDATASection($content));
    }
4012
public static StringBuffer appendCdataSection(StringBuffer buffer, String cdataContent)
	{
		StringBuffer _buffer = initStringBufferIfNecessary(buffer);
		return doAppendCdataSection(_buffer, cdataContent);
	}
801489
public static String getCdataSection(String cdataContent)
	{
		StringBuffer _result = new StringBuffer();
		return doAppendCdataSection(_result, cdataContent).toString();
	}
149189
public function inline($script, $cdata=TRUE) {
		$str=$this->_open_script();
		$str.=($cdata) ? "\n// <![CDATA[\n{$script}\n// ]]>\n" : "\n{$script}\n";
		$str.=$this->_close_script();
		return $str;
	}
1062931
public function addItem($text,
        PHPRtfLite_Font $font = null,
        PHPRtfLite_ParFormat $parFormat = null,
        $convertTagsToRtf = true
    ) {
        if ($font === null) {
            $font = $this->_font;
        }
        if ($parFormat === null) {
            $parFormat = $this->_parFormat;
        }

        $element = new PHPRtfLite_Element($this->_rtf, $text, $font, $parFormat);
        if ($convertTagsToRtf) {
            $element->setConvertTagsToRtf();
        }
        $this->_items[] = $element;

        return $this;
    }
44463
public function addMessage($text)
	{
		$this->isValid = false;
		$this->messages[] = $this->commonComment . $text;
	}
1034910
@Override
    public int writeCData(String data) throws IOException
    {
        writeAscii("<![CDATA[");
        int ix = writeCDataContent(data);
        if (ix >= 0) {
            return ix;
        }
        writeAscii("]]>");
        return -1;
    }
688628
private function printCData(&$cdata, $outline = false)
    {
        $cdata = trim($cdata);
        $ret = '';

        /*$t = '';

        if ($outline) {
            //echo $tag->getName();
            $t = ' yes';
        }*/

        if ($cdata === '') {
            return $ret;
        }

        //$e = function ($s) { return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); };

        if (
            // All top-level blocks of CDATA have to be surrounded with <p>
            //($this->m_stack->size() == 0)

            // An outline tag starts after this CDATA block
            //|| ($tag != null)
            /*||*/ $outline

            /*
             * Obvious. Should make a difference between \n and \n\n though
             * TODO
             */
            || (mb_strpos($cdata, "\n"))

            /* TODO Add FORCE_PARAGRAPHS parameter to tags (li?, blockquote, ...) */
            || ($this->m_stack->count() > 0
                    && $this->m_stack->top()->isOfType(self::TAG_FORCE_PARAGRAPHS))
        ) {
            if ($this->m_stack->count() > 0
                && $this->m_stack->top()->isOfType(self::TAG_PRE)
            ) {
                /*
                 * We are inside of a TAG_PRE tag and do not want the CDATA to
                 * be reformatted
                 */

                //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]';
                $ret .= $cdata;
            } else {
                //$cdata = $e($cdata);

                $cdata = str_replace("\n\n", '</p><p>', $cdata);
                $cdata = str_replace("\n", "<br />\n", $cdata);
                $cdata = str_replace('</p><p>', "</p>\n\n<p>", $cdata);
                //$ret .= '<p>' . '[CDATA' . $t . ']' . $cdata . '[/CDATA]' . "</p>\n";
                $ret .= '<p>' . $cdata . "</p>\n";
            }
        } else {
            /* No need to add paragraph markup (something like [li]CDATA[/li]) */

            //$ret .= '[CDATA' . $t . ']' . $cdata . '[/CDATA]';
            $ret .= $cdata;
        }

        $cdata = '';

        return $ret;
    }
74720
public static function prepare_attr_value ($text) {
		if (is_array($text)) {
			/** @noinspection ForeachSourceInspection */
			foreach ($text as &$t) {
				$t = static::prepare_attr_value($t);
			}
			return $text;
		}
		return strtr(
			$text,
			[
				'&'  => '&amp;',
				'"'  => '&quot;',
				'\'' => '&apos;',
				'<'  => '&lt;',
				'>'  => '&gt;'
			]
		);
	}
962567
protected function createDataColumn($text)
	{
		if(!preg_match('/^([\w\.]+)(:(\w*))?(:(.*))?$/',$text,$matches))
			throw new CException(Yii::t('zii','The column must be specified in the format of "Name:Type:Label", where "Type" and "Label" are optional.'));
		$column=new CDataColumn($this);
		$column->name=$matches[1];
		if(isset($matches[3]) && $matches[3]!=='')
			$column->type=$matches[3];
		if(isset($matches[5]))
			$column->header=$matches[5];
		return $column;
	}
411743
public function setNodeData(NodeData $nodeData): void
    {
        $this->nodeData = $nodeData;
        $this->nodeDataIsMatchingContext = null;
    }
1018124
public function add($name, $text) {
		$params = array(
			'name' => $name,
			'text' => $text
		);
		return $this->master->call('templates/add', $params);
	}
1195390
protected function _addAction(&$text)
    {
        // All: Add the action if left empty
        if (preg_match_all('#<\s*form[^>]+action=""#si', $text, $matches, PREG_SET_ORDER))
        {
            $action = $this->getTemplate()->route();

            foreach ($matches as $match)
            {
                $str = str_replace('action=""', 'action="' . $action . '"', $match[0]);
                $text = str_replace($match[0], $str, $text);
            }
        }

        return $this;
    }