/**
  * Convert the request data into XML.
  *
  * @since 4.3.0
  * @return string
  */
 protected function to_xml()
 {
     if (!empty($this->request_xml)) {
         return $this->request_xml;
     }
     $this->xml = new XMLWriter();
     // Create XML document in memory
     $this->xml->openMemory();
     // Set XML version & encoding
     $this->xml->startDocument('1.0', 'UTF-8');
     $request_data = $this->get_request_data();
     SV_WC_Helper::array_to_xml($this->xml, $this->get_root_element(), $request_data[$this->get_root_element()]);
     $this->xml->endDocument();
     return $this->request_xml = $this->xml->outputMemory();
 }