code: private static function encodeValueXml($value)
      {
          if ($value instanceof \DateTime) {
              return $value->format('Y-m-d\TH:i:s.000\Z');
          } elseif (is_bool($value)) {
              return $value ? 'true' : 'false';
          } else {
              return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', true);
          }
      }
docs: Helper function to convert a value into XML
  
  @param mixed $value The property value.
  
  @return string The XML.