• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

webservice/soap/classes/class.ilXMLResultSetParser.php

Go to the documentation of this file.
00001 <?php
00002 
00003 
00004 
00005   /*
00006    +-----------------------------------------------------------------------------+
00007    | ILIAS open source                                                           |
00008    +-----------------------------------------------------------------------------+
00009    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00010    |                                                                             |
00011    | This program is free software; you can redistribute it and/or               |
00012    | modify it under the terms of the GNU General Public License                 |
00013    | as published by the Free Software Foundation; either version 2              |
00014    | of the License, or (at your option) any later version.                      |
00015    |                                                                             |
00016    | This program is distributed in the hope that it will be useful,             |
00017    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00018    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00019    | GNU General Public License for more details.                                |
00020    |                                                                             |
00021    | You should have received a copy of the GNU General Public License           |
00022    | along with this program; if not, write to the Free Software                 |
00023    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00024    +-----------------------------------------------------------------------------+
00025   */
00026 
00027 
00037 include_once 'classes/class.ilSaxParser.php';
00038 include_once './webservice/soap/classes/class.ilXMLResultSet.php';
00039 
00040 class ilXMLResultSetParser extends ilSaxParser
00041 {
00042         var $xmlResultSet;
00043 
00049         function ilXMLResultSetParser($a_xml_data = '')
00050         {
00051                 parent::ilSaxParser();
00052                 $this->setXMLContent($a_xml_data);
00053         }
00054 
00055         function getXMLResultSet()
00056         {
00057                 return $this->xmlResultSet;
00058         }
00059 
00066         function setHandlers($a_xml_parser)
00067         {
00068                 xml_set_object($a_xml_parser,$this);
00069                 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
00070                 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
00071         }
00072 
00073 
00081         function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
00082         {
00083                 switch($a_name)
00084                 {
00085                         case 'result':
00086                                 $this->xmlResultSet = new ilXMLResultSet();
00087                                 break;
00088 
00089                         case 'colspecs':
00090                                 break;
00091 
00092                         case 'colspec':
00093                                 $this->xmlResultSet->addColumn ($a_attribs["idx"], $a_attribs["name"]);
00094                                 break;
00095                         case 'row':
00096                                 $this->currentRow = new ilXMLResultSetRow();
00097                                 $this->xmlResultSet->addRow ($this->currentRow);
00098                                 $this->colCounter = -1;
00099                                 break;
00100                         case 'column':
00101                                 $this->currentColumnIndex ++;
00102                                 break;
00103                 }
00104         }
00105 
00112         function handlerEndTag($a_xml_parser,$a_name)
00113         {
00114                 switch($a_name)
00115                 {
00116                         case 'column':
00117                                 $this->currentRow->setValue ($this->currentColumnIndex, $this->cdata);
00118                                 break;
00119                 }
00120         }
00121 
00128         function handlerCharacterData($a_xml_parser,$a_data)
00129         {
00130                 if($a_data != "\n")
00131                 {
00132                         // Replace multiple tabs with one space
00133                         $a_data = preg_replace("/\t+/"," ",$a_data);
00134 
00135                         $this->cdata .= $a_data;
00136                 }
00137 
00138 
00139         }
00140 
00141 }
00142 ?>

Generated on Fri Dec 13 2013 17:57:03 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1