Serialization to XML with JMS Serializer

Code
<?php

use JMS\Serializer\SerializerBuilder;
use 
JMS\Serializer\Annotation as A;

// for annotations see
// http://jmsyst.com/libs/serializer/master/reference/annotations

/**
 * A\ExclusionPolicy("all")
 * @A\XmlRoot("data")
 */
class Data
{
    private 
$id 1;
    
    private 
$name 'John Doe';
    
    
/**
     * @A\XmlKeyValuePairs
     */
    
private $values = [
        
'age' => 21,
        
'haircolor' => 'brown',
    ];
    
    private 
$null null;
}

$data = new Data();

$serializer = (new SerializerBuilder())
    ->
build();

echo 
'<pre>' htmlentities(
    
$serializer->serialize($data'xml')
) . 
'</pre>';
Result
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <id>1</id>
  <name><![CDATA[John Doe]]></name>
  <values>
    <age>21</age>
    <haircolor><![CDATA[brown]]></haircolor>
  </values>
</data>
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6