|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2011-08-03 10:34 UTC] pim at highattention dot nl
 Description: ------------ --- From manual page: http://www.php.net/function.xml-parse%23Description --- We migrate from 5.2 to 5.3 and gives a error: Parser error #73: > required on line 6, column 14. Test script: --------------- PHP ----------------------------------------- $this->_parserMemory = array(); $parser = xml_parser_create('UTF-8'); xml_set_object($parser, $this); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); xml_set_element_handler($parser, "_xmlTagOpen", "_xmlTagClose"); xml_set_character_data_handler($parser, "_xmlCdata"); if (!xml_parse($parser, $xml)) { $this->_children = array(); $error_code = xml_get_error_code($parser); $error_string = xml_error_string($error_code); $current_line = xml_get_current_line_number($parser); $current_column = xml_get_current_column_number($parser); throw new Idify_FileHandler_Xml_Exception("In {$this->_filename} : Parser error #{$error_code}: {$error_string} on line {$current_line}, column {$current_column}."); } unset($this->_parserMemory); xml_parser_free($parser); ---------------------------------------- XML ---------------------------------------- <simplexml> <name>PageControl</name> <title>Paginabeheer</title> <version>1.0.0</version> <cms_routes> <index type="default" inMenu="true" authlevel="50"> <title>Overzicht</title> <parts> <part>pagecontrol</part> <part>*</part> Expected result: ---------------- No error, system gives a new error on a attribute. Exact xml in 5.2 and 5.3, but in 5.3, he gives a error on a attribute. And gives a error on: <?xml version="1.0"?>, when I remove this line the error disapear PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 21:00:02 2025 UTC | 
<?php function parse( $xml ){ //$this->_parserMemory = array(); $parser = xml_parser_create('UTF-8'); xml_set_object($parser, $this); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF- 8'); xml_set_element_handler($parser, "_xmlTagOpen", "_xmlTagClose"); xml_set_character_data_handler($parser, "_xmlCdata"); if (!xml_parse($parser, $xml)) { $this->_children = array(); $error_code = xml_get_error_code($parser); $error_string = xml_error_string($error_code); $current_line = xml_get_current_line_number($parser); $current_column = xml_get_current_column_number($parser); echo ("Parser error #{$error_code}: {$error_string} on line {$current_line}, column {$current_column}."); } //unset($this->_parserMemory); xml_parser_free($parser); } $xml = '<simplexml> <name>PageControl</name> <title>Paginabeheer</title> <version>1.0.0</version> <cms_routes> <index type="default" inMenu="true" authlevel="50"> <title>Overzicht</title> <parts> <part>pagecontrol</part> <part>*</part> </title> </index> </cms> </version> </simplexml>'; parse( $xml ); ?>