| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
XML_Query2XML::getXML(): asterisk shortcut with attributes - overwriting with complex attribute 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 |
'attributes' => 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" name="Curtis Mayfield" birth_year="1920" birth_place="Chicago" genre="SOUL"/><artist artistid="2" name="Isaac Hayes" birth_year="1942" birth_place="Tennessee" genre="SOUL"/><artist artistid="3" name="Ray Charles" birth_year="1930" birth_place="Mississippi" genre="COUNTRY AND SOUL"/></music_library>
|