Append an <output/> element for given XPath expression to given node

@param  DOMElement $parentNode Parent node
@param  string     $expr       XPath expression
@return void
333426
protected function appendXPathOutput(DOMElement $parentNode, $expr)
	{
		$this->appendElement($parentNode, 'output', htmlspecialchars(trim($expr)))
		     ->setAttribute('type', 'xpath');
	}
236543
protected function createTextNode(ElementNode $parent, $string)
    {
        $children = $parent->getChildren();
        if (!empty($children)) {
            $lastElement = end($children);
            reset($children);

            if ($lastElement->isTextNode()) {
                $lastElement->setValue($lastElement->getValue() . $string);
                return $lastElement;
            }
        }

        $textNode = new TextNode($string);
        $parent->addChild($textNode);
        return $textNode;
    }
842802
public function evaluate($expr, DOMElement $node = null)
	{
		return $this->xpath->evaluate($expr, $node);
	}
1310000
protected function appendHTML(DOMElement $elem, string $html): DOMElement
   {
       try {
           $dom = new DOMDocument();
           $this->loadHTML($dom, $html);
           foreach($dom->childNodes as $node) {
               if ($node instanceof DOMElement) {
                   $elem->appendChild($this->template->createTextNode("\n"));
                   $elem->appendChild($this->template->importNode($node, true));
               }
           }
           return $elem;
       } catch (Throwable $e) {
           throw new RuntimeException("Can't append HTML: " . $e->getMessage());
       }
   }
584277
public function setParentNode(ElementtypeStructureNode $parentNode = null)
    {
        if ($parentNode) {
            $this->parentDsId = $parentNode->getDsId();
        }

        $this->parentNode = $parentNode;

        return $this;
    }
1070875
protected function updateNodeParent($nodeId, $parent)
    {
        $config = $this->config;
        $this->getFluent()
                ->update($config['table'])
                ->set($config['prt'], $parent)
                ->where($config['id'], $nodeId)
                ->execute();
    }
961022
function createInnerTextNode(parentNode, tokens, template) {
  var text = createHtmlText(tokens);
  var childNode = domify(template);
  childNode.innerHTML = text;
  parentNode.appendChild(childNode);
}
834487
private function isIgnoredExpressionType(Node\Expr $expr)
    {
        /**
         * We don't care about assignments, because:
         * 1. If the assigned expression ($expr->expr) is a yield expression, then:
         *  a. It had been added before moving to 7.x and is parenthesized (assigning
         *     yield expressions without parenthesis causes a syntax error in 5.x).
         *     And parenthesized yields have the same meaning in both 5.x and 7.x
         *  b. It had been added after moving to 7.x and should be left alone
         * 2. If the assigned expression is not a yield expression, then:
         *  a. It has a nested yield expression which will get caught by the enterNode method
         *  b. It has no nested yield expression and is not relevant to this visitor.
         */
        $isAssignment = $expr instanceof Node\Expr\Assign || $expr instanceof Node\Expr\AssignOp;
        $isClosureDeclaration = $expr instanceof Node\Expr\Closure;
        $isAnonymousClassInstantiation = $expr instanceof Node\Expr\New_
            && $expr->class instanceof Node\Stmt\Class_
            && !$expr->class->name;

        return $isAssignment
            || $isClosureDeclaration
            || $isAnonymousClassInstantiation
        ;
    }
229989
function appendLineParagraph( $element, $newParent )
    {
        eZDebugSetting::writeDebug( 'kernel-datatype-ezxmltext', $newParent, 'eZSimplifiedXMLInputParser::appendLineParagraph new parent' );
        $ret = array();
        $parent = $element->parentNode;
        if ( !$parent instanceof DOMElement )
        {
            return $ret;
        }

        $parentName = $parent->nodeName;
        $newParentName = $newParent != null ? $newParent->nodeName : '';

        // Correct structure by adding <line> and <paragraph> tags.
        if ( $parentName == 'line' || $this->XMLSchema->isInline( $parent ) )
        {
            return $ret;
        }

        if ( $newParentName == 'line' )
        {
            $element = $parent->removeChild( $element );
            $newParent->appendChild( $element );
            $newLine = $newParent;
            $ret['result'] = $newParent;
        }
        else if (
            $parentName === 'header'
            && (
                $parent->getElementsByTagName( 'line' )->length
                || $parent->getElementsByTagName( 'br' )->length
            )
        )
        {
            // by default the header element does not need a line element
            // unless it contains a <br> or a previously created <line>
            $newLine = $this->createAndPublishElement( 'line', $ret );
            $element = $parent->replaceChild( $newLine, $element );
            $newLine->appendChild( $element );
            $ret['result'] = $newLine;
        }
        elseif ( $parentName == 'paragraph' )
        {
            $newLine = $this->createAndPublishElement( 'line', $ret );
            $element = $parent->replaceChild( $newLine, $element );
            $newLine->appendChild( $element );
            $ret['result'] = $newLine;
        }
        elseif ( $newParentName == 'paragraph' )
        {
            $newLine = $this->createAndPublishElement( 'line', $ret );
            $element = $parent->removeChild( $element );
            $newParent->appendChild( $newLine );
            $newLine->appendChild( $element );
            $ret['result'] = $newLine;
        }
        elseif ( $this->XMLSchema->check( $parent, 'paragraph' ) )
        {
            $newLine = $this->createAndPublishElement( 'line', $ret );
            $newPara = $this->createAndPublishElement( 'paragraph', $ret );
            $element = $parent->replaceChild( $newPara, $element );
            $newPara->appendChild( $newLine );
            $newLine->appendChild( $element );
            $ret['result'] = $newLine;
        }

        return $ret;
    }
1147313
public function AddTail( $expr )
	{
		if ( $this->getCount() == 1 )
			$this->Add( $expr );
		else
			$this->getAbstractNode(1)->AddTail( $expr );
	}
314133
private function buildXml($data, \DOMDocument $doc, \DOMNode $parentNode = null)
    {
        if (is_array($data)) {
            foreach ($data as $elementName => $element) {
                if (is_int($elementName)) {
                    $elementName = 'item';
                }

                $newElement = $doc->createElement($elementName);

                if ($parentNode) {
                    $parentNode->appendChild($newElement);
                } else {
                    $doc->appendChild($newElement);
                }

                $this->buildXml($element, $doc, $newElement);
            }
        } else {
            $parentNode->nodeValue = $data;
        }
    }
1150976
public function dispatch(Expression $expr, ?AbstractNode $parentNode = null)
    {
        if ($parentNode === null) {
            $parentNode = $this->queryBuilder->where();
        }

        switch (true) {
            case $expr instanceof Comparison:
                return $this->walkComparison($expr, $parentNode);
            case $expr instanceof CompositeExpression:
                return $this->walkCompositeExpression($expr, $parentNode);
        }

        throw new \RuntimeException('Unknown Expression: ' . get_class($expr));
    }
1278030
public function toXML(DOMElement $parent) : DOMElement
    {
        Assert::notEmpty($this->OrganizationName);
        Assert::notEmpty($this->OrganizationDisplayName);
        Assert::notEmpty($this->OrganizationURL);

        $doc = $parent->ownerDocument;

        $e = $doc->createElementNS(Constants::NS_MD, 'md:Organization');
        $parent->appendChild($e);

        Extensions::addList($e, $this->Extensions);

        Utils::addStrings($e, Constants::NS_MD, 'md:OrganizationName', true, $this->OrganizationName);
        Utils::addStrings($e, Constants::NS_MD, 'md:OrganizationDisplayName', true, $this->OrganizationDisplayName);
        Utils::addStrings($e, Constants::NS_MD, 'md:OrganizationURL', true, $this->OrganizationURL);

        return $e;
    }
748668
public function toXML(DOMElement $parent) : ?DOMElement
    {
        $e = null;
        if (!empty($this->DisplayName)
         || !empty($this->Description)
         || !empty($this->InformationURL)
         || !empty($this->PrivacyStatementURL)
         || !empty($this->Keywords)
         || !empty($this->Logo)
         || !empty($this->children)
        ) {
            $doc = $parent->ownerDocument;

            $e = $doc->createElementNS(Common::NS, 'mdui:UIInfo');
            $parent->appendChild($e);

            Utils::addStrings($e, Common::NS, 'mdui:DisplayName', true, $this->DisplayName);
            Utils::addStrings($e, Common::NS, 'mdui:Description', true, $this->Description);
            Utils::addStrings($e, Common::NS, 'mdui:InformationURL', true, $this->InformationURL);
            Utils::addStrings($e, Common::NS, 'mdui:PrivacyStatementURL', true, $this->PrivacyStatementURL);

            foreach ($this->Keywords as $child) {
                $child->toXML($e);
            }

            foreach ($this->Logo as $child) {
                $child->toXML($e);
            }

            foreach ($this->children as $child) {
                $child->toXML($e);
            }
        }

        return $e;
    }
715197
private function buildXmlDir($parentXmlElement, $parentDirectory)
    {
        $xmlDir = $parentXmlElement->addChild('dir');
        $xmlDir->addAttribute('name', $parentDirectory['name']);

        foreach ($parentDirectory['directories'] as $directory) {
            $this->buildXmlDir($xmlDir, $directory);
        }
        foreach ($parentDirectory['files'] as $file) {
            $this->buildXmlFile($xmlDir, $file, $parentDirectory['real_path']);
        }

        return $this;
    }
957577
public function toXML(DOMElement $parent) : DOMElement
    {
        return Utils::addString($parent, XMLSecurityDSig::XMLDSIGNS, 'ds:X509Certificate', $this->getCertificate());
    }
1155860
public function add($parentexpr, $value, $name = "")
    {
        $get = $this->get($parentexpr);
        if ($parents =& $get) {

            foreach ($parents as &$parent) {
                $parent = is_array($parent) ? $parent : array();

                if ($name != "") {
                    $parent[$name] = $value;
                } else {
                    $parent[] = $value;
                }
            }

            return true;
        }

        return false;
    }