Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
00133 $a_data = preg_replace("/\t+/"," ",$a_data);
00134
00135 $this->cdata .= $a_data;
00136 }
00137
00138
00139 }
00140
00141 }
00142 ?>