Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php
/**
 * XML_Serializer
 *
 * Creates XML documents from PHP data structures like arrays, objects or scalars.
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   XML
 * @package    ImmoScout24Export
 * @author     Markus Niewerth <markus@weban.de>
 * @copyright  1997-2007 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    CVS: $Id: ImmoScout24Export.php,v 1.0 2007/09/27 9:45:30 markusniewerth Exp $
 * @link       http://pear.php.net/package/XML_Serializer
 * @see        XML_Unserializer
 */


error_reporting(E_ALL ^ E_WARNING);

/**
 * Creates XML documents from PHP data structures like arrays, objects or scalars.
 *
 * this class can be used in two modes:
 *
 *  1. create an XML document from an array or object that is processed by other
 *    applications. That means, you can create a RDF document from an array in the
 *    following format:
 *
 *    $data = array(
 *              'channel' => array(
 *                            'title' => 'Example RDF channel',
 *                            'link'  => 'http://www.php-tools.de',
 *                            'image' => array(
 *                                        'title' => 'Example image',
 *                                        'url'   => 'http://www.php-tools.de/image.gif',
 *                                        'link'  => 'http://www.php-tools.de'
 *                                           ),
 *                            array(
 *                                 'title' => 'Example item',
 *                                 'link'  => 'http://example.com'
 *                                 ),
 *                            array(
 *                                 'title' => 'Another Example item',
 *                                 'link'  => 'http://example.org'
 *                                 )
 *                              )
 *             );
 *
 *   to create a RDF document from this array do the following:
 *
 *   require_once 'XML/Serializer.php';
 *
 *   $options = array(
 *                     XML_SERIALIZER_OPTION_INDENT      => "\t",        // indent with tabs
 *                     XML_SERIALIZER_OPTION_LINEBREAKS  => "\n",        // use UNIX line breaks
 *                     XML_SERIALIZER_OPTION_ROOT_NAME   => 'rdf:RDF',   // root tag
 *                     XML_SERIALIZER_OPTION_DEFAULT_TAG => 'item'       // tag for values with numeric keys
 *   );
 *
 *   $serializer = new XML_Serializer($options);
 *   $rdf        = $serializer->serialize($data);
 *
 * You will get a complete XML document that can be processed like any RDF document.
 *
 * 2. this classes can be used to serialize any data structure in a way that it can
 *    later be unserialized again.
 *    XML_Serializer will store the type of the value and additional meta information
 *    in attributes of the surrounding tag. This meat information can later be used
 *    to restore the original data structure in PHP. If you want XML_Serializer
 *    to add meta information to the tags, add
 *
 *      XML_SERIALIZER_OPTION_TYPEHINTS => true
 *
 *    to the options array in the constructor.
 *
 * @category   XML
 * @package    ImmoScout24Export
 * @author     Markus Niewerth <markus@weban.de>
 * @copyright  1997-2007 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    CVS: $Id: ImmoScout24Export.php,v 1.0 2007/09/27 9:45:30 markusniewerth Exp $
 * @link       http://pear.php.net/package/XML_Serializer
 * @see        XML_Unserializer
 */

       
$tags = array(

                "IS24ImmobilienTransfer"        => array (
             "xmlns"                                    =>      "http://www.immobilienscout24.de/immobilientransfer",
             "xmlns:xsi"                        =>      "http://www.w3.org/2001/XMLSchema-instance",
             "xsi:schemaLocation"               =>      "http://www.immobilienscout24.de/immobilientransfer is24immotransfer.xsd",
             "ErstellerSoftware"                =>      "ImmoScout24Export",
             "ErstellerSoftwareVersion" =>      "1.0",
             "EmailBeiFehler"                   =>      "markus@weban.de"
                ),
                "Anbieter"                                      => array ( 
                         "ScoutKundenID"                        =>      "30302"
                ),
                "WohnungMiete"                          => array (
                        "AnbieterObjektID"              =>      "0815",
                        "Ueberschrift"                  =>      "Schöne Wohnung" ,
                        "Importmodus"                   =>      "importieren" ,
                        "Wohnflaeche"                   =>      "100.00" ,
                        "Zimmer"                                =>      "4.00" ,
                        "Adressdruck"                   =>      "true" ,
                        "AnzahlBadezimmer"              =>      "2" ,
                        "AnzahlSchlafzimmer"    =>      "2" ,
                        "Aufzug"                                =>      "true" ,
                        "BalkonTerrasse"                =>      "true" ,
                        "Baujahr"                               =>      "1869" ,
                        "BetreutesWohnen"               =>      "true" ,
                        "Einbaukueche"                  =>      "true" ,
                        "Etage"                                 =>      "2" ,
                        "Etagenzahl"                    =>      "6" ,
                        "Foerderung"                    =>      "true" ,
                        "FreiAb"                                =>      "sofort" ,
                        "GartenBenutzung"               =>      "true" ,
                        "GruppierungsID"                =>      "1" ,
                        "Haustiere"                             =>      "nachVereinbarung" ,
                        "Heizungsart"                   =>      "Zentralheizung" ,
                        "Nutzflaeche"                   =>      "22" ,
                        "Objektzustand"                 =>      "Gepflegt" ,
                        "Parkplatz"                             =>      "true" ,
                        "Provision"                             =>      "3.8% zzg. 16%MSt" ,
                        "Rollstuhlgerecht"              =>      "true" ,
                        "StatusHP"                              =>      "aktiv" ,
                        "StatusIS24"                    =>      "aktiv" ,
                        "StatusVBM"                             =>      "aktiv" ,
                        "Waehrung"                              =>      "EUR" ,
                        "WohnungKategorie"              =>      "Etagenwohnung"
                )
);

require_once 'XML/Query2XML.php';
require_once 'MDB2.php';

$query2xml = XML_Query2XML::factory(MDB2::factory('mysql://gwg_gladbeck_de:g-w7-a@localhost/gwg_gladbeck_de'));

$dom = $query2xml->getXML(
  "SELECT * FROM directory",
  array(
    'rootTag' => 'IS24ImmobilienTransfer',
    'idColumn' => 'ID',
    'rowTag' => 'WohnungMiete',
    'elements' => array(),
    'attributes' => array(
      'name' => "Name",
      'Bild' => "bild_url",
      'Stati' => 'status'
    )
  )
);

//header('Content-Type: application/xml');
$dom->formatOutput = true;
print $dom->saveXML();

?>