You are here

public function RestWSFormatXML::viewResource in RESTful Web Services 7.2

Same name and namespace in other branches
  1. 7 restws.formats.inc \RestWSFormatXML::viewResource()

Gets the representation of a resource.

Overrides RestWSBaseFormat::viewResource

File

./restws.formats.inc, line 493
RESTful web services module formats.

Class

RestWSFormatXML
A formatter for XML.

Code

public function viewResource($resourceController, $id) {
  $xml = new DOMDocument('1.0', 'utf-8');
  $element = $xml
    ->createElement($resourceController
    ->resource());
  self::addToXML($xml, $element, $resourceController
    ->wrapper($id));
  $xml
    ->appendChild($element);
  $function = __FUNCTION__;
  drupal_alter('restws_response', $xml, $function, $this->formatName, $resourceController);
  return $xml
    ->saveXML();
}