74 $this->xml_file = $a_xml_file;
75 $this->input_type =
'file';
85 $this->xml_content = $a_xml_content;
86 $this->input_type =
'string';
115 $this->
parse($xml_parser,$fp);
119 $this->
parse($xml_parser);
123 $this->
handleError(
"No input type given. Set filename in constructor or choose setXMLContent()",
124 $this->ilias->error_obj->FATAL);
137 $xml_parser = xml_parser_create(
"UTF-8");
139 if($xml_parser ==
false)
141 $this->
handleError(
"Cannot create an XML parser handle",$this->ilias->error_obj->FATAL);
152 xml_parser_set_option($a_xml_parser,XML_OPTION_CASE_FOLDING,
false);
161 echo
'ilSaxParser::setHandlers() must be overwritten';
171 if(!($fp = fopen($this->xml_file,
'r')))
173 $this->
handleError(
"Cannot open xml file \"".$this->xml_file.
"\"",$this->ilias->error_obj->FATAL);
183 function parse($a_xml_parser,$a_fp = null)
189 while($data = fread($a_fp,4096))
191 $parseOk = xml_parse($a_xml_parser,$data,feof($a_fp));
200 && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
202 $errorCode = xml_get_error_code($a_xml_parser);
203 $line = xml_get_current_line_number($a_xml_parser);
204 $col = xml_get_current_column_number($a_xml_parser);
205 $this->
handleError(
"XML Parse Error: ".xml_error_string($errorCode).
" at line ".$line.
", col ". $col .
" (Code: ".$errorCode.
")" ,$this->ilias->error_obj->FATAL);
219 if ($this->throwException) {
220 require_once (
'./Services/Xml/exceptions/class.ilSaxParserException.php');
223 if (is_object($this->ilias))
225 $this->ilias->raiseError($message, $code);
241 if(!xml_parser_free($a_xml_parser))
243 $this->ilias->raiseError(
"Error freeing xml parser handle ",$this->ilias->error_obj->FATAL);