| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
XML_Query2XML::getXML(): asterisk shortcut with elements - overwriting with complex element specification
|
|
|
3 |
--SKIPIF--
|
|
|
4 |
<?php require_once dirname(dirname(__FILE__)) . '/skipif.php'; ?>
|
|
|
5 |
--FILE--
|
|
|
6 |
<?php
|
|
|
7 |
require_once 'XML/Query2XML.php';
|
|
|
8 |
require_once dirname(dirname(__FILE__)) . '/db_init.php';
|
|
|
9 |
$query2xml =& XML_Query2XML::factory($db);
|
|
|
10 |
$dom =& $query2xml->getXML(
|
|
|
11 |
"SELECT
|
|
|
12 |
*
|
|
|
13 |
FROM
|
|
|
14 |
artist
|
|
|
15 |
ORDER BY
|
|
|
16 |
artistid",
|
|
|
17 |
array(
|
|
|
18 |
'rootTag' => 'music_library',
|
|
|
19 |
'rowTag' => 'artist',
|
|
|
20 |
'idColumn' => 'artistid',
|
|
|
21 |
'elements' => array(
|
|
|
22 |
'*' => '*',
|
|
|
23 |
'genre' => array(
|
|
|
24 |
'value' => '#genre2upper()'
|
|
|
25 |
)
|
|
|
26 |
)
|
|
|
27 |
)
|
|
|
28 |
);
|
|
|
29 |
print $dom->saveXML();
|
|
|
30 |
|
|
|
31 |
function genre2upper($record)
|
|
|
32 |
{
|
|
|
33 |
return strtoupper($record['genre']);
|
|
|
34 |
}
|
|
|
35 |
?>
|
|
|
36 |
--EXPECT--
|
|
|
37 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
38 |
<music_library><artist><artistid>1</artistid><name>Curtis Mayfield</name><birth_year>1920</birth_year><birth_place>Chicago</birth_place><genre>SOUL</genre></artist><artist><artistid>2</artistid><name>Isaac Hayes</name><birth_year>1942</birth_year><birth_place>Tennessee</birth_place><genre>SOUL</genre></artist><artist><artistid>3</artistid><name>Ray Charles</name><birth_year>1930</birth_year><birth_place>Mississippi</birth_place><genre>COUNTRY AND SOUL</genre></artist></music_library>
|