You are here

public function RestfulFormatterHalXml::render in RESTful 7

Renders an array in the selected format.

Parameters

array $structured_data: The data prepared to be rendered as returned by \RestfulFormatterInterface::prepare().

Return value

string The body contents for the HTTP response.

Overrides RestfulFormatterHalJson::render

File

modules/restful_example/plugins/formatter/RestfulFormatterHalXml.class.php, line 20
Contains RestfulFormatterHalJson.

Class

RestfulFormatterHalXml
@file Contains RestfulFormatterHalJson.

Code

public function render(array $structured_data) {
  return $this
    ->arrayToXML($structured_data, new SimpleXMLElement('<api/>'))
    ->asXML();
}