1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /**
- * File name:
- *
- *
- * (C) Copyright 2013 Friedrich-Ebert-Stiftung (http://fes.ro)
- * Author: Tiberiu C. Turbureanu (tct@ceata.org)
- *
- * This file is part of the project funded by FES
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- // Load the list of persons
- $xml = new DOMDocument();
- $xml->load('../20131013-consilieri.xml');
- $xpath = new DOMXpath($xml);
- $persons = $xpath->query("/xml/person");
- foreach($persons as $person)
- {
- // Get index name
- $comname = $xpath->query("comname", $person)->item(0)->nodeValue;
- $surname = $xpath->query("surname", $person)->item(0)->nodeValue;
- $iname = $comname.'-'.$surname;
- $pmb = new DOMDocument();
- $pmb->load('../profile/00-pmb/'.$iname.'.xml');
- $liste = new DOMDocument();
- $liste->load('../profile/01-liste/'.$iname.'.xml');
- $x = $pmb->getElementsByTagName("xml")->item(0);
- $a = $pmb->getElementsByTagName("affiliation")->item(0);
- $a1 = $liste->getElementsByTagName("affiliation")->item(0);
- $x->replaceChild($pmb->importNode($a1->cloneNode(true), true), $a);
- $a = $pmb->getElementsByTagName("birthdate")->item(0);
- $a1 = $liste->getElementsByTagName("birthdate")->item(0);
- $x->replaceChild($pmb->importNode($a1->cloneNode(true), true), $a);
- $a = $liste->getElementsByTagName("sex")->item(0);
- $x->appendChild($pmb->importNode($a->cloneNode(true), true));
- $a = $liste->getElementsByTagName("party")->item(0);
- $x->appendChild($pmb->importNode($a->cloneNode(true), true));
- $pmb->save('../profile/'.$iname.'.xml');
- }
- ?>
|