Xataface 2.0
Xataface Application Framework
Dataface/ImportFilter/xml.php
Go to the documentation of this file.
00001 <?php
00002 /*-------------------------------------------------------------------------------
00003  * Xataface Web Application Framework
00004  * Copyright (C) 2005-2008 Web Lite Solutions Corp (shannah@sfu.ca)
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *-------------------------------------------------------------------------------
00020  */
00021 
00049 require_once 'Dataface/ImportFilter.php';
00050 require_once 'xml2array.php';
00051 
00052 class Dataface_ImportFilter_xml extends Dataface_ImportFilter {
00053 
00054         function Dataface_ImportFilter_xml(){
00055                 $this->name = 'xml';
00056                 $this->label = 'XML';
00057         }
00058         
00059         
00060         function import(&$data){
00061                 $arr = GetXMLTree ($data);
00062                 $arr = $arr['dataface'];
00063                 
00064                 $records = array();
00065                 foreach (array_keys($arr) as $tablename){
00066                         foreach ( array_keys($arr[$tablename]) as $index){
00067                                 $records[] = new Dataface_Record($tablename, $arr[$tablename][$index]);
00068                         }
00069                 }
00070                 
00071                 return $records;
00072         }
00073 
00074 }
 All Data Structures Namespaces Files Functions Variables Enumerations