Modify data structure of a view REST export I need to build a sitemap.xml with a REST export with a view.
By default I get this data structure with a REST export. 

&lt;?xml version="1.0"?&gt;
  &lt;response&gt;
    &lt;item key="0"&gt;
      &lt;field1&gt;...


How can I modify the tags of this structure? I need to get this tags. 

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;
    &lt;url&gt;
      &lt;loc&gt;...


These tags must be changed. 

&lt;response&gt; &gt; &lt;urlset...
&lt;item&gt; &gt; &lt;url&gt;


Do I write a custom serializer for the REST export or a specific encoder? How do I proceed?
In D8 you need to create custom serializer and encoder to alter the XML tags.


Create custom serializer
Ref :  https://gist.github.com/BERRAMOU/dd21e009eec0e3d98733e78360122892
Write custom encoder


-

namespace Drupal\custom_serializer;
use Drupal\serialization\Encoder\XmlEncoder as SerializationXMLEncoder;
use SimpleXMLElement;
 /**
 * Encodes xml API data.
 *
 * @internal
 */
class myXMLEncoder extends SerializationXMLEncoder {

  /**
   * The formats that this Encoder supports.
   *
   * @var string
   */
  protected static $format = ['myxml'];

  /**
   * {@inheritdoc}
   */
  public function getBaseEncoder() {
    $base_encoder = parent::getBaseEncoder();
    $base_encoder-&gt;setRootNodeName('jobs');
    return $base_encoder;
  }
}



Then in View under 'FORMAT' you will see both options.
After save, you should get XML with required tag.