Neos\FluidAdaptor\Service\AbstractGenerator::addChildWithCData PHP Метод

addChildWithCData() защищенный Метод

Add a child node to $parentXmlNode, and wrap the contents inside a CDATA section.
protected addChildWithCData ( SimpleXMLElement $parentXmlNode, string $childNodeName, string $childNodeValue ) : SimpleXMLElement
$parentXmlNode SimpleXMLElement Parent XML Node to add the child to
$childNodeName string Name of the child node
$childNodeValue string Value of the child node. Will be placed inside CDATA.
Результат SimpleXMLElement the new element
    protected function addChildWithCData(\SimpleXMLElement $parentXmlNode, $childNodeName, $childNodeValue)
    {
        $parentDomNode = dom_import_simplexml($parentXmlNode);
        $domDocument = new \DOMDocument();
        $childNode = $domDocument->appendChild($domDocument->createElement($childNodeName));
        $childNode->appendChild($domDocument->createCDATASection($childNodeValue));
        $childNodeTarget = $parentDomNode->ownerDocument->importNode($childNode, true);
        $parentDomNode->appendChild($childNodeTarget);
        return simplexml_import_dom($childNodeTarget);
    }