You are here

public function HttpClientXMLFormatter::__construct in Http Client 7.2

Same name and namespace in other branches
  1. 6.2 includes/HttpClientXMLFormatter.inc \HttpClientXMLFormatter::__construct()

Creates a HttpClientXMLFormatter.

Parameters

string $default_root: Optional. Defaults to 'result'. The default name that should be used for root elements, if $adaptive_root is set to FALSE the default name will always be used.

bool $adaptive_root: Optional. Defaults to FALSE. If $adaptive_root is set to TRUE and the source data has a single root attribute the serializer will use that attribute as root. The object {"foo":"bar"} would be serialized to <foo>bar</foo> instead of <result><foo>bar</foo></result>.

File

includes/formatter/HttpClientXMLFormatter.inc, line 25

Class

HttpClientXMLFormatter
Class for handling xml-responses. Returns a SimpleXML object

Code

public function __construct($default_root = 'result', $adaptive_root = FALSE) {
  $this->default_root = $default_root;
  $this->adaptive_root = $adaptive_root;
}