- Timestamp:
- Dec 22, 2008, 9:57:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/xml.php
r35 r39 14 14 # and returns an equivalent PHP data structure 15 15 ################################################################################### 16 if( ! function_exists( 'XML_unserialize' ) ) : // d3pipe Used function 16 17 function & XML_unserialize(&$xml){ 17 18 $xml_parser = &new XML(); … … 20 21 return $data; 21 22 } 23 endif; 22 24 ################################################################################### 23 25 # XML_serialize: serializes any PHP data structure into XML 24 26 # Takes one parameter: the data to serialize. Must be an array. 25 27 ################################################################################### 28 if( ! function_exists( 'XML_serialize' ) ) : // d3pipe Used function 26 29 function & XML_serialize(&$data, $level = 0, $prior_key = NULL){ 27 30 if($level == 0){ ob_start(); echo '<?xml version="1.0" ?>',"\n"; } … … 49 52 if($level == 0){ $str = &ob_get_contents(); ob_end_clean(); return $str; } 50 53 } 54 endif; 51 55 ################################################################################### 52 56 # XML class: utility class to be used with PHP's XML handling functions … … 60 64 61 65 function XML(){ 62 $this->parser = &xml_parser_create(); 66 // $this->parser = &xml_parser_create(); 67 $this->parser = xml_parser_create(); // GIJ 68 /* 63 69 xml_parser_set_option(&$this->parser, XML_OPTION_CASE_FOLDING, false); 64 70 xml_set_object(&$this->parser, &$this); 65 71 xml_set_element_handler(&$this->parser, 'open','close'); 66 72 xml_set_character_data_handler(&$this->parser, 'data'); 73 */ 74 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false); 75 xml_set_object($this->parser, $this); 76 xml_set_element_handler($this->parser, 'open','close'); 77 xml_set_character_data_handler($this->parser, 'data'); 67 78 } 68 function destruct(){ xml_parser_free(&$this->parser); } 79 function destruct(){ 80 // xml_parser_free(&$this->parser); // GIJ 81 xml_parser_free($this->parser); 82 } 69 83 function & parse(&$data){ 70 84 $this->document = array(); 71 85 $this->stack = array(); 72 86 $this->parent = &$this->document; 73 return xml_parse(&$this->parser, &$data, true) ? $this->document : NULL; 87 // return xml_parse(&$this->parser, &$data, true) ? $this->document : NULL; // GIJ 88 $ret = @xml_parse($this->parser, $data, true) ? $this->document : NULL; 89 return $ret ; 74 90 } 75 91 function open(&$parser, $tag, $attributes){
Note: See TracChangeset
for help on using the changeset viewer.