XML_Query2XML
[ class tree: XML_Query2XML ] [ index: XML_Query2XML ] [ all elements ]

Source for file case02.php

Documentation is available at case02.php

  1. <?php
  2. require_once('XML/Query2XML.php');
  3. require_once('DB.php');
  4. $query2xml XML_Query2XML::factory(DB::connect('mysql://root@localhost/Query2XML_Tests'));
  5. $dom $query2xml->getXML(
  6.     "SELECT
  7.         *
  8.      FROM
  9.         artist
  10.         LEFT JOIN album ON album.artist_id = artist.artistid",
  11.     array(
  12.         'rootTag' => 'music_library',
  13.         'rowTag' => 'artist',
  14.         'idColumn' => 'artistid',
  15.         'elements' => array(
  16.             'artistid',
  17.             'name',
  18.             'birth_year',
  19.             'birth_place',
  20.             'genre',
  21.             'albums' => array(
  22.                 'rootTag' => 'albums',
  23.                 'rowTag' => 'album',
  24.                 'idColumn' => 'albumid',
  25.                 'elements' => array(
  26.                     'albumid',
  27.                     'title',
  28.                     'published_year',
  29.                     'comment'
  30.                 )
  31.             )
  32.         )
  33.     )
  34. );
  35.  
  36. header('Content-Type: application/xml');
  37. echo '<?xml version="1.0" encoding="UTF-8"?>' "\n";
  38.  
  39. require_once('XML/Beautifier.php');
  40. $beautifier = new XML_Beautifier();
  41. print $beautifier->formatString($dom->saveXML());
  42. ?>

Documentation generated on Mon, 11 Mar 2019 14:48:19 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.