24 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
58 $this->has_error = FALSE;
68 xml_set_object($a_xml_parser,$this);
69 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
70 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
78 parent::startParsing();
86 function parse($a_xml_parser,$a_fp = null)
92 while(
$data = fread($a_fp,4096))
94 $parseOk = xml_parse($a_xml_parser,
$data,feof($a_fp));
103 && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
105 $this->error_code = xml_get_error_code($a_xml_parser);
106 $this->error_line = xml_get_current_line_number($a_xml_parser);
107 $this->error_col = xml_get_current_column_number($a_xml_parser);
108 $this->error_msg = xml_error_string($a_xml_parser);
109 $this->has_error = TRUE;
121 $this->attributes+=count($a_attribs);
137 $this->text_size+=strlen($a_data);
162 return "Error: ".$this->error_msg.
" at line:".$this->error_line .
" column:".
$this->error_col;
__construct($a_xml_file='', $throwException=false)
Constructor.
parse($a_xml_parser, $a_fp=null)
parse xml file
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
startParsing()
start the parser
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
handlerEndTag($a_xml_parser, $a_name)
handler for end of element