94 $this->xml_file = $a_xml_file;
95 $this->input_type =
'file';
105 $this->xml_content = $a_xml_content;
106 $this->input_type =
'string';
135 $this->
parse($xml_parser,$fp);
139 $this->
parse($xml_parser);
143 $this->
handleError(
"No input type given. Set filename in constructor or choose setXMLContent()",
144 $this->ilias->error_obj->FATAL);
156 $xml_parser = xml_parser_create(
"UTF-8");
158 if($xml_parser ==
false)
160 $this->
handleError(
"Cannot create an XML parser handle",$this->ilias->error_obj->FATAL);
171 xml_parser_set_option($a_xml_parser,XML_OPTION_CASE_FOLDING,
false);
180 echo
'ilSaxParser::setHandlers() must be overwritten';
189 if(!($fp = fopen($this->xml_file,
'r')))
191 $this->
handleError(
"Cannot open xml file \"".$this->xml_file.
"\"",$this->ilias->error_obj->FATAL);
200 function parse($a_xml_parser,$a_fp = null)
206 while(
$data = fread($a_fp,4096))
208 $parseOk = xml_parse($a_xml_parser,
$data,feof($a_fp));
217 && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
219 $errorCode = xml_get_error_code($a_xml_parser);
220 $line = xml_get_current_line_number($a_xml_parser);
221 $col = xml_get_current_column_number($a_xml_parser);
222 $this->
handleError(
"XML Parse Error: ".xml_error_string($errorCode).
" at line ".$line.
", col ". $col .
" (Code: ".$errorCode.
")" ,$this->ilias->error_obj->FATAL);
235 if ($this->throwException) {
236 require_once (
'./classes/class.ilSaxParserException.php');
239 if (is_object($this->ilias))
241 $this->ilias->raiseError($message, $code);
257 if(!xml_parser_free($a_xml_parser))
259 $this->ilias->raiseError(
"Error freeing xml parser handle ",$this->ilias->error_obj->FATAL);