XMLDataSource

class XMLDataSource
setSchema($schema)

Set the Schema for the DataSource. Schema is an array of fields and the types, options associated with them

Example :: array ( ‘FieldName1’ => array(‘type’ => ‘text’), ‘FieldName2’ => array(‘type’ => ‘number’) );

Parameters:
  • $schema (array) – Schema for the DataSource
setDataObjPath($path, $namespace)

If your JSON data is nested deeper than the root level, you can specify that by setting the data object path. So for example, if your JSON string is

<book>
<description> Books Section </description>
<section_id>3234324</section_id>
<item>
<title>Book 1</title>
<link>http://foobar/book1</link>
<item>
<item>
<title>Book 2</title>
<link>http://foobar/book2</link>
</item>
</book>

Then the data object path is /book/item

Parameters:
  • $path (string) –
  • $namespace (string) –
setFilePath($filePath)

If you are loading from a XML file on your server, then provide the full path to the file.

Parameters:
  • $filePath (string) –
setUrl($url)

Set the URL from which the XML string will be loaded

Parameters:
  • $url (string) –
setPostData($postData)

Set the data to be sent along with a POST request. The POST data should be an associative array.

Parameters:
  • $postData (array) –
setHeaders($headers)

Set the custom headers to the request. Pass the headers as a key-value pair.

Parameters:
  • $headers (array) –
setMethod($method)

Set the HTTP request method type

Parameters:
  • $method (string) –
setOptions($options)

Set the options for fetching the data.

Parameters:
  • $options (array|RFHttpOptions) –
initialize()

Loads data into the internal database. This is an internal method.

forceCacheOverWrite()

Even if a cache is available, overwrite it.,

configureCaching($caching)

Configure the caching, by passing an array with the following keys (both optional)

  • enabled => true/false - whether caching is enabled
  • cacheDuration => number of seconds before data is refreshed
Parameters:
  • $caching (array) – Array containing caching parameters
enableCaching()

Enables caching

cacheExists()

Check if a cache exists for the current datasource

setSQLSource($source)

Set the SQL source from which the data is seeded.

Parameters:
  • $source (string) –

Start building interactive, mobile-friendly Dashboards in PHP. See DemosDownload