You are here

public function RestWSFormatXML::viewResource in RESTful Web Services 7

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

Gets the representation of a resource.

Overrides RestWSBaseFormat::viewResource

File

./restws.formats.inc, line 215
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);
  return $xml
    ->saveXML();
}