You are here

public function RestWSFormatXML::createResource in RESTful Web Services 7

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

Creates a new resource.

Overrides RestWSBaseFormat::createResource

File

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

Class

RestWSFormatXML
A formatter for XML.

Code

public function createResource($resourceController, $data) {
  $values = $this
    ->unserialize($data);
  $id = $resourceController
    ->create($values);
  $xml = new DOMDocument('1.0', 'utf-8');
  $element = $xml
    ->createElement('uri');
  self::setXMLReference($element, $resourceController
    ->resource(), $id);
  $xml
    ->appendChild($element);
  return $xml
    ->saveXML();
}