73 $this->xml_file = $a_xml_file;
74 $this->input_type =
'file';
84 $this->xml_content = $a_xml_content;
85 $this->input_type =
'string';
114 $this->
parse($xml_parser,$fp);
118 $this->
parse($xml_parser);
122 $this->
handleError(
"No input type given. Set filename in constructor or choose setXMLContent()",
123 $this->ilias->error_obj->FATAL);
136 $xml_parser = xml_parser_create(
"UTF-8");
138 if($xml_parser ==
false)
140 $this->
handleError(
"Cannot create an XML parser handle",$this->ilias->error_obj->FATAL);
151 xml_parser_set_option($a_xml_parser,XML_OPTION_CASE_FOLDING,
false);
160 echo
'ilSaxParser::setHandlers() must be overwritten';
170 if(!($fp = fopen($this->xml_file,
'r')))
172 $this->
handleError(
"Cannot open xml file \"".$this->xml_file.
"\"",$this->ilias->error_obj->FATAL);
182 function parse($a_xml_parser,$a_fp = null)
188 while(
$data = fread($a_fp,4096))
190 $parseOk = xml_parse($a_xml_parser,
$data,feof($a_fp));
199 && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
201 $errorCode = xml_get_error_code($a_xml_parser);
202 $line = xml_get_current_line_number($a_xml_parser);
203 $col = xml_get_current_column_number($a_xml_parser);
204 $this->
handleError(
"XML Parse Error: ".xml_error_string($errorCode).
" at line ".$line.
", col ". $col .
" (Code: ".$errorCode.
")" ,$this->ilias->error_obj->FATAL);
218 if ($this->throwException) {
219 require_once (
'./classes/class.ilSaxParserException.php');
222 if (is_object($this->ilias))
224 $this->ilias->raiseError($message, $code);
240 if(!xml_parser_free($a_xml_parser))
242 $this->ilias->raiseError(
"Error freeing xml parser handle ",$this->ilias->error_obj->FATAL);