function __construct($spec)
 {
     if (!isset($spec['url'])) {
         $spec['url'] = 'http://openlibrary.org/api/books?bibkeys=ISBN:{isbn}&details=true';
         //TODO: custom function to normalize ISBN (trim, strip dashes, correct checksum, etc)
         //       <^demon> Daniel_WMDE: I believe Special:BookSources has an ISBN normalization thing. Might be worth looking at.
     }
     if (!isset($spec['dataFormat'])) {
         $spec['dataFormat'] = 'json';
     }
     if (!isset($spec['errorPath'])) {
         $spec['errorPath'] = '?';
     }
     if (!isset($spec['keyFields'])) {
         $spec['keyFields'] = 'isbn';
     }
     if (!isset($spec['fieldNames'])) {
         $spec['fieldNames'] = array('author', 'date', 'publisher', 'title', 'url', 'city', 'edition', 'ISBN10', 'ISBN13', 'LCC', 'LCCN', 'DDC', 'pages', 'series', 'subtitle', 'language', 'editor');
     }
     if (!isset($spec['sourceInfo'])) {
         $spec['sourceInfo'] = array();
     }
     if (!isset($spec['transformer'])) {
         $spec['transformer'] = new OpenLibraryRecordTransformer(array());
     }
     if (!isset($spec['sourceInfo']['description'])) {
         $spec['sourceInfo']['description'] = 'The Open Library Project';
     }
     if (!isset($spec['sourceInfo']['homepage'])) {
         $spec['sourceInfo']['homepage'] = 'http://openlibrary.org';
     }
     if (!isset($spec['sourceInfo']['license'])) {
         $spec['sourceInfo']['license'] = 'PD';
     }
     WebDataTransclusionSource::__construct($spec);
 }
    $dir = dirname(__FILE__);
    if (file_exists("{$dir}/../../LocalSettings.php")) {
        $IP = "{$dir}/../..";
    } elseif (file_exists("{$dir}/../../../LocalSettings.php")) {
        $IP = "{$dir}/../../..";
    } elseif (file_exists("{$dir}/../../phase3/LocalSettings.php")) {
        $IP = "{$dir}/../../phase3";
    } elseif (file_exists("{$dir}/../../../phase3/LocalSettings.php")) {
        $IP = "{$dir}/../../../phase3";
    } else {
        $IP = $dir;
    }
}
require_once "{$IP}/maintenance/commandLine.inc";
$dir = dirname(__FILE__);
$dtbase = dirname(realpath($dir));
require_once "{$dtbase}/DataTransclusionSource.php";
require_once "{$dtbase}/WebDataTransclusionSource.php";
$url = $args[0];
$format = $args[1];
$spec = array('name' => 'Dummy', 'keyFields' => 'id', 'url' => 'http://test.com/', 'dataFormat' => $format);
$web = new WebDataTransclusionSource($spec);
$raw = $web->loadRecordDataFromURL($url);
if (!$raw) {
    die("failed to load data from {$url}\n");
}
$data = $web->decodeData($raw, $format);
if (!$data) {
    die("failed to decode({$format}) data from {$url}\n");
}
print_r($data);
 function testXmlDataTransclusionSource()
 {
     $spec = array('name' => 'FOO', 'keyFields' => 'item', 'optionNames' => 'lang', 'url' => 'http://acme.com/{name}', 'dataFormat' => 'xml', 'transformer' => array('class' => 'XPathFlattenRecord', 'dataPath' => '/rdf:RDF', 'errorPath' => '/html//*[@class="error"]', 'fieldPathes' => array('latitude' => './/pos:lat', 'longitude' => './/pos:long')), 'fieldNames' => 'latitude,longitude');
     $spec['url'] = 'file://' . dirname(realpath(__FILE__)) . '/test-data-item-{item}.rdf.xml';
     $source = new WebDataTransclusionSource($spec);
     $rec = $source->fetchRecord('item', 'Berlin');
     $this->assertEquals("52.461", $rec['latitude']);
 }