7 http://www.shop24-7.info/32-0-simplexml-alternative-php4.html
11 - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
12 dans la fonction parse($data) pour la prise en compte de la casse
14 - if($attribs) $this->data['attrs'] = $attribs;
15 dans la fonction tag_open pour la prise en compte des attributs
29 function parse($data){
30 // $this->parser = xml_parser_create('UTF-8');
31 $this->data = array();
32 $this->datas = array();
33 $this->parser = xml_parser_create();
34 xml_set_object($this->parser, $this);
35 xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
36 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
37 xml_set_element_handler($this->parser, 'tag_open', 'tag_close');
38 xml_set_character_data_handler($this->parser, 'cdata');
39 if (!xml_parse($this->parser, $data)){
40 $this->data = array();
41 $this->error_code = xml_get_error_code($this->parser);
42 $this->error_string = xml_error_string($this->error_code);
43 $this->current_line = xml_get_current_line_number($this->parser);
44 $this->current_column = xml_get_current_column_number($this->parser);
47 $this->data = $this->data['subs'];
49 xml_parser_free($this->parser);
52 function tag_open($parser, $tag, $attribs){
53 $this->datas[] = &$this->data;
54 $this->data = &$this->data['subs'][$tag][];
55 if($attribs) $this->data['attrs'] = $attribs;
58 function cdata($parser, $cdata){
59 @$this->data['data'] .= $cdata;
62 function tag_close($parser, $tag){
63 $this->data =& $this->datas[count($this->datas)-1];
64 array_pop($this->datas);