src/Viserio/Component/Parser/Dumper/XmlDumper.php
public function dump(array $data): string
    {
        try {
            $document = new DOMDocument($data['version'] ?? '1.0', $data['encoding'] ?? '');

            if (isset($data['version'])) {
                unset($data['version']);
            }

            if (isset($data['encoding'])) {
                unset($data['encoding']);
            }

            if (\count($data) !== 0 && self::isArrayAllKeySequential($data)) {
                throw new DOMException('Invalid Character Error.');
            }

            $root = $this->createRootElement($document, $data['root'] ?? '');

            if (isset($data['root'])) {
                unset($data['root']);
            }

            $document->appendChild($root);

            $this->convertElement($document, $root, $data);

            return $document->saveXML();
        } catch (DOMException $exception) {
            throw new DumpException(
                $exception->getMessage(),
                $exception->getCode(),
                $exception
            );
        }
    }
public function dump(array $data): string
    {
        try {
            $document = new DOMDocument($data['version'] ?? '1.0', $data['encoding'] ?? '');

            if (isset($data['version'])) {
                unset($data['version']);
            }

            if (isset($data['encoding'])) {
                unset($data['encoding']);
            }

            if (\count($data) !== 0 && self::isArrayAllKeySequential($data)) {
                throw new DOMException('Invalid Character Error.');
            }

            $root = $this->createRootElement($document, $data['root'] ?? '');

            if (isset($data['root'])) {
                unset($data['root']);
            }

            $document->appendChild($root);

            $this->convertElement($document, $root, $data);

            return $document->saveXML();
        } catch (DOMException $exception) {
            throw new DumpException(
                $exception->getMessage(),
                $exception->getCode(),
                $exception
            );
        }
    }
{@inheritdoc}

array[]
['root']                           string|array A optional option; String if you like to change the root name or
array for more options.
['rootElementName']            string       A optional option; The name of the root element
['_attributes or @attributes'] array
['key']                    string
['version']                        string       A optional option;
['encoding']                       string       A optional option; to set the file encoding
['key']                            string|array
['_attributes or @attributes'] array        A optional option;
['key']                    string       A optional option;
['_value or @value']           string       A optional option;
['_cdata or @cdata']           string       A optional option;