Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
xml.php
Go to the documentation of this file.
1 <?php
2 /*-------------------------------------------------------------------------------
3  * Xataface Web Application Framework
4  * Copyright (C) 2005-2008 Web Lite Solutions Corp (shannah@sfu.ca)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *-------------------------------------------------------------------------------
20  */
21 
49 require_once 'Dataface/ImportFilter.php';
50 require_once 'xml2array.php';
51 
53 
55  $this->name = 'xml';
56  $this->label = 'XML';
57  }
58 
59 
60  function import(&$data){
61  $arr = GetXMLTree ($data);
62  $arr = $arr['dataface'];
63 
64  $records = array();
65  foreach (array_keys($arr) as $tablename){
66  foreach ( array_keys($arr[$tablename]) as $index){
67  $records[] = new Dataface_Record($tablename, $arr[$tablename][$index]);
68  }
69  }
70 
71  return $records;
72  }
73 
74 }