Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
XML_Query2XML::registerPrefix(): prefix class in external file
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
$query2xml->registerPrefix('-', 'Year2UnixTime', dirname($argv[0]) . './Year2UnixTime.php');
11
 
12
$dom = $query2xml->getXML(
13
  "SELECT * FROM artist",
14
  array(
15
    'rootTag' => 'artists',
16
    'idColumn' => 'artistid',
17
    'rowTag' => 'artist',
18
    'elements' => array(
19
        'name',
20
        'birth_year',
21
        'birth_year_in_unix_time' => '-birth_year'
22
    )
23
  )
24
);
25
 
26
header('Content-Type: application/xml');
27
$dom->formatOutput = true;
28
print $dom->saveXML();
29
?>
30
--EXPECT--
31
<?xml version="1.0" encoding="UTF-8"?>
32
<artists>
33
  <artist>
34
    <name>Curtis Mayfield</name>
35
    <birth_year>1920</birth_year>
36
    <birth_year_in_unix_time>-1577923200</birth_year_in_unix_time>
37
  </artist>
38
  <artist>
39
    <name>Isaac Hayes</name>
40
    <birth_year>1942</birth_year>
41
    <birth_year_in_unix_time>-883612800</birth_year_in_unix_time>
42
  </artist>
43
  <artist>
44
    <name>Ray Charles</name>
45
    <birth_year>1930</birth_year>
46
    <birth_year_in_unix_time>-1262304000</birth_year_in_unix_time>
47
  </artist>
48
</artists>