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::getXML(): Case06
3
--SKIPIF--
4
<?php
5
require_once dirname(dirname(__FILE__)) . '/skipif.php';
6
if (strpos(DSN, 'sqlite') === 0 && strpos(DSN, 'sqlite3') !== 0) {
7
    echo 'skip sqlite before v3.1 does not support backreferences to fields in parent table - see http://www.sqlite.org/cvstrac/wiki?p=UnsupportedSql';
8
    exit;
9
}
10
?>
11
--FILE--
12
<?php
13
require_once 'XML/Query2XML.php';
14
require_once 'XML/Query2XML/Callback.php';
15
require_once dirname(dirname(__FILE__)) . '/db_init.php';
16
 
17
/**Static class that provides validation and parsing methods for
18
* generating XML.
19
*
20
* It is static so that we can easyly call its methods from inside
21
* Query2XML using eval'd code.
22
*/
23
class Helper
24
{
25
    /**Associative array of US postal state codes*/
26
    public static $statePostalCodes = array(
27
        'ALABAMA' => 'AL', 'ALASKA' => 'AK', 'AMERICAN SAMOA' => 'AS', 'ARIZONA' => 'AZ', 'ARKANSAS' => 'AR', 'CALIFORNIA' => 'CA',
28
        'COLORADO' => 'CO', 'CONNECTICUT' => 'CT', 'DELAWARE' => 'DE', 'DISTRICT OF COLUMBIA' => 'DC', 'FEDERATED STATES OF MICRONESIA' => 'FM',
29
        'FLORIDA' => 'FL', 'GEORGIA' => 'GA', 'GUAM' => 'GU', 'HAWAII' => 'HI', 'IDAHO' => 'ID', 'ILLINOIS' => 'IL', 'INDIANA' => 'IN',
30
        'IOWA' => 'IA', 'KANSAS' => 'KS', 'KENTUCKY' => 'KY', 'LOUISIANA' => 'LA', 'MAINE' => 'ME', 'MARSHALL ISLANDS' => 'MH', 'MARYLAND' => 'MD',
31
        'MASSACHUSETTS' => 'MA', 'MICHIGAN' => 'MI', 'MINNESOTA' => 'MN', 'MISSISSIPPI' => 'MS', 'MISSOURI' => 'MO', 'MONTANA' => 'MT',
32
        'NEBRASKA' => 'NE', 'NEVADA' => 'NV', 'NEW HAMPSHIRE' => 'NH', 'NEW JERSEY' => 'NJ', 'NEW JESEY' => 'NJ', 'NEW MEXICO' => 'NM', 'NEW YORK' => 'NY',
33
        'NORTH CAROLINA' => 'NC', 'NORTH DAKOTA' => 'ND', 'NORTHERN MARIANA ISLANDS' => 'MP', 'OHIO' => 'OH', 'OKLAHOMA' => 'OK', 'OREGON' => 'OR',
34
        'PALAU' => 'PW', 'PENNSYLVANIA' => 'PA', 'PUERTO RICO' => 'PR', 'RHODE ISLAND' => 'RI', 'SOUTH CAROLINA' => 'SC', 'SOUTH DAKOTA' => 'SD',
35
        'TENNESSEE' => 'TN', 'TEXAS' => 'TX', 'UTAH' => 'UT', 'VERMONT' => 'VT', 'VIRGIN ISLANDS' => 'VI', 'VIRGINIA' => 'VA', 'WASHINGTON' => 'WA',
36
        'WEST VIRGINIA' => 'WV', 'WISCONSIN' => 'WI', 'WYOMING' => 'WY'
37
    );
38
 
39
    /**Translates a US state name into its two-letter postal code.
40
    * If the translation fails, $state is returned unchanged
41
    * @param $record The record
42
    */
43
    public static function getStatePostalCode($record)
44
    {
45
        $state = $record["state"];
46
        $s = str_replace("  ", " ", trim(strtoupper($state)));
47
        if (isset(self::$statePostalCodes[$s])) {
48
            return self::$statePostalCodes[$s];
49
        } else {
50
            return $state;
51
        }
52
    }
53
 
54
    function summarize($str, $limit=50, $appendString=' ...')
55
    {
56
        if (strlen($str) > $limit) {
57
            $str = substr($str, 0, $limit - strlen($appendString)) . $appendString;
58
        }
59
        return $str;
60
    }
61
 
62
    function summarizeComment($record, $limit)
63
    {
64
        return self::summarize($record["comment"], $limit);
65
    }
66
}
67
 
68
/**Command class that implements the command pattern.
69
* It implements the XML_Query2XML_Callback interface
70
* and therefore has to provide the public non-static
71
* method execute(array $record).
72
*/
73
class UppercaseColumnCommand implements XML_Query2XML_Callback
74
{
75
    public function __construct($columnName)
76
    {
77
        $this->_columnName = $columnName;
78
    }
79
    public function execute(array $record)
80
    {
81
        return strtoupper($record[$this->_columnName]);
82
    }
83
}
84
 
85
$query2xml = XML_Query2XML::factory($db);
86
$dom = $query2xml->getXML(
87
    "SELECT
88
         s.*,
89
         manager.employeeid AS manager_employeeid,
90
         manager.employeename AS manager_employeename,
91
         d.*,
92
         department_head.employeeid AS department_head_employeeid,
93
         department_head.employeename AS department_head_employeename,
94
         e.*,
95
         sa.*,
96
         c.*,
97
         al.*,
98
         ar.*,
99
         (SELECT COUNT(*) FROM sale WHERE sale.store_id = s.storeid) AS store_sales,
100
         (SELECT
101
            COUNT(*)
102
          FROM
103
            sale, employee, employee_department
104
          WHERE
105
            sale.employee_id = employee.employeeid
106
            AND
107
            employee_department.employee_id = employee.employeeid
108
            AND
109
            employee_department.department_id = d.departmentid
110
         ) AS department_sales,
111
         (SELECT
112
            COUNT(*)
113
          FROM
114
            employee, employee_department, department
115
          WHERE
116
            employee_department.employee_id = employee.employeeid
117
            AND
118
            employee_department.department_id = department.departmentid
119
            AND
120
            department.store_id = s.storeid
121
         ) AS store_employees,
122
         (SELECT
123
            COUNT(*)
124
          FROM
125
            employee, employee_department
126
          WHERE
127
            employee_department.employee_id = employee.employeeid
128
            AND
129
            employee_department.department_id = d.departmentid
130
         ) AS department_employees
131
     FROM
132
         store s
133
          LEFT JOIN employee manager ON s.manager = manager.employeeid
134
         LEFT JOIN department d ON d.store_id = s.storeid
135
          LEFT JOIN employee department_head ON department_head.employeeid = d.department_head
136
          LEFT JOIN employee_department ed ON ed.department_id = d.departmentid
137
           LEFT JOIN employee e ON e.employeeid = ed.employee_id
138
            LEFT JOIN sale sa ON sa.employee_id = e.employeeid
139
             LEFT JOIN customer c ON c.customerid = sa.customer_id
140
             LEFT JOIN album al ON al.albumid = sa.album_id
141
              LEFT JOIN artist ar ON ar.artistid = al.artist_id
142
     ORDER BY
143
        s.storeid,
144
        manager.employeeid,
145
        d.departmentid,
146
        department_head.employeeid,
147
        ed.employee_id,
148
        ed.department_id,
149
        e.employeeid,
150
        sa.saleid,
151
        c.customerid,
152
        al.albumid,
153
        ar.artistid",
154
    array(
155
        'rootTag' => 'music_company',
156
        'rowTag' => 'store',
157
        'idColumn' => 'storeid',
158
        'attributes' => array(
159
            'storeid'
160
        ),
161
        'elements' => array(
162
            'store_sales',
163
            'store_employees',
164
            'manager' => array(
165
                'idColumn' => 'manager_employeeid',
166
                'attributes' => array(
167
                    'manager_employeeid'
168
                ),
169
                'elements' => array(
170
                    'manager_employeename'
171
                )
172
            ),
173
            'address' => array(
174
                'elements' => array(
175
                    'country',
176
                    'state' => '#Helper::getStatePostalCode()',
177
                    'city' => new UppercaseColumnCommand('city'),
178
                    'street',
179
                    'phone'
180
                )
181
            ),
182
            'department' => array(
183
                'idColumn' => 'departmentid',
184
                'attributes' => array(
185
                    'departmentid'
186
                ),
187
                'elements' => array(
188
                    'department_sales',
189
                    'department_employees',
190
                    'departmentname',
191
                    'department_head' => array(
192
                        'idColumn' => 'department_head_employeeid',
193
                        'attributes' => array(
194
                            'department_head_employeeid'
195
                        ),
196
                        'elements' => array(
197
                            'department_head_employeename'
198
                        )
199
                    ),
200
                    'employees' => array(
201
                        'rootTag' => 'employees',
202
                        'rowTag' => 'employee',
203
                        'idColumn' => 'employeeid',
204
                        'attributes' => array(
205
                            'employeeid'
206
                        ),
207
                        'elements' => array(
208
                            'employeename',
209
                            'sales' => array(
210
                                'rootTag' => 'sales',
211
                                'rowTag' => 'sale',
212
                                'idColumn' => 'saleid',
213
                                'attributes' => array(
214
                                    'saleid'
215
                                ),
216
                                'elements' => array(
217
                                    'timestamp',
218
                                    'customer' => array(
219
                                        'idColumn' => 'customerid',
220
                                        'attributes' => array(
221
                                            'customerid'
222
                                        ),
223
                                        'elements' => array(
224
                                            'first_name',
225
                                            'last_name',
226
                                            'email'
227
                                        )
228
                                    ),
229
                                    'album' => array(
230
                                        'idColumn' => 'albumid',
231
                                        'attributes' => array(
232
                                            'albumid'
233
                                        ),
234
                                        'elements' => array(
235
                                            'title',
236
                                            'published_year',
237
                                            'comment' => '?#Helper::summarizeComment(12)',
238
                                            'artist' => array(
239
                                                'idColumn' => 'artistid',
240
                                                'attributes' => array(
241
                                                    'artistid'
242
                                                ),
243
                                                'elements' => array(
244
                                                    'name',
245
                                                    'birth_year',
246
                                                    'birth_place',
247
                                                    'genre'
248
                                                )
249
                                            )
250
                                        ) // album elements
251
                                    ) //album array
252
                                ) //sales elements
253
                            ) //sales array
254
                        ) //employees elements
255
                    ) //employees array
256
                ) //department elements
257
            ) // department array
258
        ) //root elements
259
    ) //root
260
); //getXML method call
261
 
262
$root = $dom->firstChild;
263
$root->setAttribute('date_generated', '2005-08-23T14:52:50');
264
 
265
header('Content-Type: application/xml');
266
 
267
$dom->formatOutput = true;
268
print $dom->saveXML();
269
?>
270
--EXPECT--
271
<?xml version="1.0" encoding="UTF-8"?>
272
<music_company date_generated="2005-08-23T14:52:50">
273
  <store storeid="1">
274
    <store_sales>10</store_sales>
275
    <store_employees>6</store_employees>
276
    <manager manager_employeeid="1">
277
      <manager_employeename>Michael Jones</manager_employeename>
278
    </manager>
279
    <address>
280
      <country>US</country>
281
      <state>NY</state>
282
      <city>NEW YORK</city>
283
      <street>Broadway &amp; 72nd Str</street>
284
      <phone>123 456 7890</phone>
285
    </address>
286
    <department departmentid="1">
287
      <department_sales>10</department_sales>
288
      <department_employees>3</department_employees>
289
      <departmentname>Sales</departmentname>
290
      <department_head department_head_employeeid="1">
291
        <department_head_employeename>Michael Jones</department_head_employeename>
292
      </department_head>
293
      <employees>
294
        <employee employeeid="1">
295
          <employeename>Michael Jones</employeename>
296
          <sales>
297
            <sale saleid="1">
298
              <timestamp>2005-05-25 16:32:00</timestamp>
299
              <customer customerid="1">
300
                <first_name>Jane</first_name>
301
                <last_name>Doe</last_name>
302
                <email>jane.doe@example.com</email>
303
              </customer>
304
              <album albumid="1">
305
                <title>New World Order</title>
306
                <published_year>1990</published_year>
307
                <comment>the best ...</comment>
308
                <artist artistid="1">
309
                  <name>Curtis Mayfield</name>
310
                  <birth_year>1920</birth_year>
311
                  <birth_place>Chicago</birth_place>
312
                  <genre>Soul</genre>
313
                </artist>
314
              </album>
315
            </sale>
316
            <sale saleid="7">
317
              <timestamp>2005-07-10 15:03:00</timestamp>
318
              <customer customerid="7">
319
                <first_name>Nick</first_name>
320
                <last_name>Fallow</last_name>
321
                <email>nick.fallow@example.com</email>
322
              </customer>
323
              <album albumid="1">
324
                <title>New World Order</title>
325
                <published_year>1990</published_year>
326
                <comment>the best ...</comment>
327
                <artist artistid="1">
328
                  <name>Curtis Mayfield</name>
329
                  <birth_year>1920</birth_year>
330
                  <birth_place>Chicago</birth_place>
331
                  <genre>Soul</genre>
332
                </artist>
333
              </album>
334
            </sale>
335
            <sale saleid="16">
336
              <timestamp>2005-06-05 12:56:12</timestamp>
337
              <customer customerid="2">
338
                <first_name>John</first_name>
339
                <last_name>Doe</last_name>
340
                <email>john.doe@example.com</email>
341
              </customer>
342
              <album albumid="3">
343
                <title>Shaft</title>
344
                <published_year>1972</published_year>
345
                <comment>he's the man</comment>
346
                <artist artistid="2">
347
                  <name>Isaac Hayes</name>
348
                  <birth_year>1942</birth_year>
349
                  <birth_place>Tennessee</birth_place>
350
                  <genre>Soul</genre>
351
                </artist>
352
              </album>
353
            </sale>
354
            <sale saleid="19">
355
              <timestamp>2005-07-10 16:03:01</timestamp>
356
              <customer customerid="8">
357
                <first_name>Ed</first_name>
358
                <last_name>Burton</last_name>
359
                <email>ed.burton@example.com</email>
360
              </customer>
361
              <album albumid="3">
362
                <title>Shaft</title>
363
                <published_year>1972</published_year>
364
                <comment>he's the man</comment>
365
                <artist artistid="2">
366
                  <name>Isaac Hayes</name>
367
                  <birth_year>1942</birth_year>
368
                  <birth_place>Tennessee</birth_place>
369
                  <genre>Soul</genre>
370
                </artist>
371
              </album>
372
            </sale>
373
          </sales>
374
        </employee>
375
        <employee employeeid="2">
376
          <employeename>Susi Weintraub</employeename>
377
          <sales>
378
            <sale saleid="3">
379
              <timestamp>2005-07-10 11:03:00</timestamp>
380
              <customer customerid="3">
381
                <first_name>Susan</first_name>
382
                <last_name>Green</last_name>
383
                <email>susan.green@example.com</email>
384
              </customer>
385
              <album albumid="1">
386
                <title>New World Order</title>
387
                <published_year>1990</published_year>
388
                <comment>the best ...</comment>
389
                <artist artistid="1">
390
                  <name>Curtis Mayfield</name>
391
                  <birth_year>1920</birth_year>
392
                  <birth_place>Chicago</birth_place>
393
                  <genre>Soul</genre>
394
                </artist>
395
              </album>
396
            </sale>
397
            <sale saleid="9">
398
              <timestamp>2005-07-10 18:03:00</timestamp>
399
              <customer customerid="9">
400
                <first_name>Jack</first_name>
401
                <last_name>Woo</last_name>
402
                <email>jack.woo@example.com</email>
403
              </customer>
404
              <album albumid="1">
405
                <title>New World Order</title>
406
                <published_year>1990</published_year>
407
                <comment>the best ...</comment>
408
                <artist artistid="1">
409
                  <name>Curtis Mayfield</name>
410
                  <birth_year>1920</birth_year>
411
                  <birth_place>Chicago</birth_place>
412
                  <genre>Soul</genre>
413
                </artist>
414
              </album>
415
            </sale>
416
            <sale saleid="17">
417
              <timestamp>2005-07-10 10:03:32</timestamp>
418
              <customer customerid="4">
419
                <first_name>Victoria</first_name>
420
                <last_name>Alt</last_name>
421
                <email>victory.alt@example.com</email>
422
              </customer>
423
              <album albumid="3">
424
                <title>Shaft</title>
425
                <published_year>1972</published_year>
426
                <comment>he's the man</comment>
427
                <artist artistid="2">
428
                  <name>Isaac Hayes</name>
429
                  <birth_year>1942</birth_year>
430
                  <birth_place>Tennessee</birth_place>
431
                  <genre>Soul</genre>
432
                </artist>
433
              </album>
434
            </sale>
435
            <sale saleid="20">
436
              <timestamp>2005-07-10 19:03:50</timestamp>
437
              <customer customerid="10">
438
                <first_name>Maria</first_name>
439
                <last_name>Gonzales</last_name>
440
                <email>maria.gonzales@example.com</email>
441
              </customer>
442
              <album albumid="3">
443
                <title>Shaft</title>
444
                <published_year>1972</published_year>
445
                <comment>he's the man</comment>
446
                <artist artistid="2">
447
                  <name>Isaac Hayes</name>
448
                  <birth_year>1942</birth_year>
449
                  <birth_place>Tennessee</birth_place>
450
                  <genre>Soul</genre>
451
                </artist>
452
              </album>
453
            </sale>
454
          </sales>
455
        </employee>
456
        <employee employeeid="3">
457
          <employeename>Steve Hack</employeename>
458
          <sales>
459
            <sale saleid="5">
460
              <timestamp>2005-07-10 13:03:00</timestamp>
461
              <customer customerid="5">
462
                <first_name>Will</first_name>
463
                <last_name>Rippy</last_name>
464
                <email>will.wippy@example.com</email>
465
              </customer>
466
              <album albumid="1">
467
                <title>New World Order</title>
468
                <published_year>1990</published_year>
469
                <comment>the best ...</comment>
470
                <artist artistid="1">
471
                  <name>Curtis Mayfield</name>
472
                  <birth_year>1920</birth_year>
473
                  <birth_place>Chicago</birth_place>
474
                  <genre>Soul</genre>
475
                </artist>
476
              </album>
477
            </sale>
478
            <sale saleid="18">
479
              <timestamp>2005-07-10 14:03:52</timestamp>
480
              <customer customerid="6">
481
                <first_name>Tim</first_name>
482
                <last_name>Raw</last_name>
483
                <email>tim.raw@example.com</email>
484
              </customer>
485
              <album albumid="3">
486
                <title>Shaft</title>
487
                <published_year>1972</published_year>
488
                <comment>he's the man</comment>
489
                <artist artistid="2">
490
                  <name>Isaac Hayes</name>
491
                  <birth_year>1942</birth_year>
492
                  <birth_place>Tennessee</birth_place>
493
                  <genre>Soul</genre>
494
                </artist>
495
              </album>
496
            </sale>
497
          </sales>
498
        </employee>
499
      </employees>
500
    </department>
501
    <department departmentid="2">
502
      <department_sales>0</department_sales>
503
      <department_employees>3</department_employees>
504
      <departmentname>Marketing</departmentname>
505
      <department_head department_head_employeeid="4">
506
        <department_head_employeename>Joan Kerr</department_head_employeename>
507
      </department_head>
508
      <employees>
509
        <employee employeeid="4">
510
          <employeename>Joan Kerr</employeename>
511
          <sales/>
512
        </employee>
513
        <employee employeeid="5">
514
          <employeename>Marcus Roth</employeename>
515
          <sales/>
516
        </employee>
517
        <employee employeeid="6">
518
          <employeename>Jack Mack</employeename>
519
          <sales/>
520
        </employee>
521
      </employees>
522
    </department>
523
  </store>
524
  <store storeid="2">
525
    <store_sales>10</store_sales>
526
    <store_employees>6</store_employees>
527
    <manager manager_employeeid="2">
528
      <manager_employeename>Susi Weintraub</manager_employeename>
529
    </manager>
530
    <address>
531
      <country>US</country>
532
      <state>NY</state>
533
      <city>LARCHMONT</city>
534
      <street>Palmer Ave 71</street>
535
      <phone>456 7890</phone>
536
    </address>
537
    <department departmentid="3">
538
      <department_sales>10</department_sales>
539
      <department_employees>3</department_employees>
540
      <departmentname>Sales</departmentname>
541
      <department_head department_head_employeeid="7">
542
        <department_head_employeename>Rita Doktor</department_head_employeename>
543
      </department_head>
544
      <employees>
545
        <employee employeeid="7">
546
          <employeename>Rita Doktor</employeename>
547
          <sales>
548
            <sale saleid="2">
549
              <timestamp>2005-06-05 12:56:00</timestamp>
550
              <customer customerid="2">
551
                <first_name>John</first_name>
552
                <last_name>Doe</last_name>
553
                <email>john.doe@example.com</email>
554
              </customer>
555
              <album albumid="1">
556
                <title>New World Order</title>
557
                <published_year>1990</published_year>
558
                <comment>the best ...</comment>
559
                <artist artistid="1">
560
                  <name>Curtis Mayfield</name>
561
                  <birth_year>1920</birth_year>
562
                  <birth_place>Chicago</birth_place>
563
                  <genre>Soul</genre>
564
                </artist>
565
              </album>
566
            </sale>
567
            <sale saleid="8">
568
              <timestamp>2005-07-10 16:03:00</timestamp>
569
              <customer customerid="8">
570
                <first_name>Ed</first_name>
571
                <last_name>Burton</last_name>
572
                <email>ed.burton@example.com</email>
573
              </customer>
574
              <album albumid="1">
575
                <title>New World Order</title>
576
                <published_year>1990</published_year>
577
                <comment>the best ...</comment>
578
                <artist artistid="1">
579
                  <name>Curtis Mayfield</name>
580
                  <birth_year>1920</birth_year>
581
                  <birth_place>Chicago</birth_place>
582
                  <genre>Soul</genre>
583
                </artist>
584
              </album>
585
            </sale>
586
            <sale saleid="11">
587
              <timestamp>2005-05-25 16:23:00</timestamp>
588
              <customer customerid="1">
589
                <first_name>Jane</first_name>
590
                <last_name>Doe</last_name>
591
                <email>jane.doe@example.com</email>
592
              </customer>
593
              <album albumid="2">
594
                <title>Curtis</title>
595
                <published_year>1970</published_year>
596
                <comment>that man ...</comment>
597
                <artist artistid="1">
598
                  <name>Curtis Mayfield</name>
599
                  <birth_year>1920</birth_year>
600
                  <birth_place>Chicago</birth_place>
601
                  <genre>Soul</genre>
602
                </artist>
603
              </album>
604
            </sale>
605
            <sale saleid="14">
606
              <timestamp>2005-07-10 15:09:00</timestamp>
607
              <customer customerid="7">
608
                <first_name>Nick</first_name>
609
                <last_name>Fallow</last_name>
610
                <email>nick.fallow@example.com</email>
611
              </customer>
612
              <album albumid="2">
613
                <title>Curtis</title>
614
                <published_year>1970</published_year>
615
                <comment>that man ...</comment>
616
                <artist artistid="1">
617
                  <name>Curtis Mayfield</name>
618
                  <birth_year>1920</birth_year>
619
                  <birth_place>Chicago</birth_place>
620
                  <genre>Soul</genre>
621
                </artist>
622
              </album>
623
            </sale>
624
          </sales>
625
        </employee>
626
        <employee employeeid="8">
627
          <employeename>David Til</employeename>
628
          <sales>
629
            <sale saleid="4">
630
              <timestamp>2005-07-10 10:03:00</timestamp>
631
              <customer customerid="4">
632
                <first_name>Victoria</first_name>
633
                <last_name>Alt</last_name>
634
                <email>victory.alt@example.com</email>
635
              </customer>
636
              <album albumid="1">
637
                <title>New World Order</title>
638
                <published_year>1990</published_year>
639
                <comment>the best ...</comment>
640
                <artist artistid="1">
641
                  <name>Curtis Mayfield</name>
642
                  <birth_year>1920</birth_year>
643
                  <birth_place>Chicago</birth_place>
644
                  <genre>Soul</genre>
645
                </artist>
646
              </album>
647
            </sale>
648
            <sale saleid="10">
649
              <timestamp>2005-07-10 19:03:00</timestamp>
650
              <customer customerid="10">
651
                <first_name>Maria</first_name>
652
                <last_name>Gonzales</last_name>
653
                <email>maria.gonzales@example.com</email>
654
              </customer>
655
              <album albumid="1">
656
                <title>New World Order</title>
657
                <published_year>1990</published_year>
658
                <comment>the best ...</comment>
659
                <artist artistid="1">
660
                  <name>Curtis Mayfield</name>
661
                  <birth_year>1920</birth_year>
662
                  <birth_place>Chicago</birth_place>
663
                  <genre>Soul</genre>
664
                </artist>
665
              </album>
666
            </sale>
667
            <sale saleid="12">
668
              <timestamp>2005-07-10 11:56:00</timestamp>
669
              <customer customerid="3">
670
                <first_name>Susan</first_name>
671
                <last_name>Green</last_name>
672
                <email>susan.green@example.com</email>
673
              </customer>
674
              <album albumid="2">
675
                <title>Curtis</title>
676
                <published_year>1970</published_year>
677
                <comment>that man ...</comment>
678
                <artist artistid="1">
679
                  <name>Curtis Mayfield</name>
680
                  <birth_year>1920</birth_year>
681
                  <birth_place>Chicago</birth_place>
682
                  <genre>Soul</genre>
683
                </artist>
684
              </album>
685
            </sale>
686
            <sale saleid="15">
687
              <timestamp>2005-07-10 18:49:00</timestamp>
688
              <customer customerid="9">
689
                <first_name>Jack</first_name>
690
                <last_name>Woo</last_name>
691
                <email>jack.woo@example.com</email>
692
              </customer>
693
              <album albumid="2">
694
                <title>Curtis</title>
695
                <published_year>1970</published_year>
696
                <comment>that man ...</comment>
697
                <artist artistid="1">
698
                  <name>Curtis Mayfield</name>
699
                  <birth_year>1920</birth_year>
700
                  <birth_place>Chicago</birth_place>
701
                  <genre>Soul</genre>
702
                </artist>
703
              </album>
704
            </sale>
705
          </sales>
706
        </employee>
707
        <employee employeeid="9">
708
          <employeename>Pia Eist</employeename>
709
          <sales>
710
            <sale saleid="6">
711
              <timestamp>2005-07-10 14:03:00</timestamp>
712
              <customer customerid="6">
713
                <first_name>Tim</first_name>
714
                <last_name>Raw</last_name>
715
                <email>tim.raw@example.com</email>
716
              </customer>
717
              <album albumid="1">
718
                <title>New World Order</title>
719
                <published_year>1990</published_year>
720
                <comment>the best ...</comment>
721
                <artist artistid="1">
722
                  <name>Curtis Mayfield</name>
723
                  <birth_year>1920</birth_year>
724
                  <birth_place>Chicago</birth_place>
725
                  <genre>Soul</genre>
726
                </artist>
727
              </album>
728
            </sale>
729
            <sale saleid="13">
730
              <timestamp>2005-07-10 13:12:00</timestamp>
731
              <customer customerid="5">
732
                <first_name>Will</first_name>
733
                <last_name>Rippy</last_name>
734
                <email>will.wippy@example.com</email>
735
              </customer>
736
              <album albumid="2">
737
                <title>Curtis</title>
738
                <published_year>1970</published_year>
739
                <comment>that man ...</comment>
740
                <artist artistid="1">
741
                  <name>Curtis Mayfield</name>
742
                  <birth_year>1920</birth_year>
743
                  <birth_place>Chicago</birth_place>
744
                  <genre>Soul</genre>
745
                </artist>
746
              </album>
747
            </sale>
748
          </sales>
749
        </employee>
750
      </employees>
751
    </department>
752
    <department departmentid="4">
753
      <department_sales>0</department_sales>
754
      <department_employees>3</department_employees>
755
      <departmentname>Marketing</departmentname>
756
      <department_head department_head_employeeid="10">
757
        <department_head_employeename>Hanna Poll</department_head_employeename>
758
      </department_head>
759
      <employees>
760
        <employee employeeid="10">
761
          <employeename>Hanna Poll</employeename>
762
          <sales/>
763
        </employee>
764
        <employee employeeid="11">
765
          <employeename>Jim Wells</employeename>
766
          <sales/>
767
        </employee>
768
        <employee employeeid="12">
769
          <employeename>Sandra Wilson</employeename>
770
          <sales/>
771
        </employee>
772
      </employees>
773
    </department>
774
  </store>
775
</music_company>