Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. XmlEncoder.php

function XmlEncoder::appendNode

Selects the type of node to create and appends it to the parent.

2 calls to XmlEncoder::appendNode()
XmlEncoder::buildXml in vendor/symfony/serializer/Encoder/XmlEncoder.php
Parse the data and convert it to DOMElements.
XmlEncoder::encode in vendor/symfony/serializer/Encoder/XmlEncoder.php
Encodes data into the given format.

File

vendor/symfony/serializer/Encoder/XmlEncoder.php, line 416

Class

XmlEncoder
@author Jordi Boggiano <j.boggiano@seld.be> @author John Wards <jwards@whiteoctober.co.uk> @author Fabian Vogler <fabian@equivalence.ch> @author Kévin Dunglas <dunglas@gmail.com> @author Dany Maillard…

Namespace

Symfony\Component\Serializer\Encoder

Code

private function appendNode(\DOMNode $parentNode, mixed $data, string $format, array $context, string $nodeName, ?string $key = null) : bool {
    $dom = $parentNode instanceof \DOMDocument ? $parentNode : $parentNode->ownerDocument;
    $node = $dom->createElement($nodeName);
    if (null !== $key) {
        $node->setAttribute('key', $key);
    }
    $appendNode = $this->selectNodeType($node, $data, $format, $context);
    // we may have decided not to append this node, either in error or if its $nodeName is not valid
    if ($appendNode) {
        $parentNode->appendChild($node);
    }
    return $appendNode;
}
RSS feed
Powered by Drupal