ID: 10994 Updated by: mfischer Reported By: [EMAIL PROTECTED] Old Status: Open Status: Feedback Bug Type: DOM XML related Operating System: Winnt PHP Version: 4.0.5 New Comment:
Can you try with latest RC and see if it works http://www.php.net/~zeev/php-4.1.0RC3.tar.gz Feedback. Previous Comments: ------------------------------------------------------------------------ [2001-05-21 13:49:12] [EMAIL PROTECTED] Hello Dear PHP Support. I have compatability problem with PHP 4.04 - PHP 4.05, exactly in DOMXML (i mean) module. This is piece of my code: ------------------------------------------------------------- <? function XML_Def_Parse($xml_file) { $doc = xmldoc(join("", file($xml_file)) ); $ctx = xpath_new_context($doc ); // $doc_vars = xml_parse_vars($ctx, "//DOC/VAR"); $obj = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK"); $arr = $obj->nodeset; for($block_n=1; $block_n<sizeof($arr)+1; ++$block_n) { $block_vars = xml_parse_vars($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/VAR"); $obj2 = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET"); $arr2 = $obj2->nodeset; for($blockset_n=1; $blockset_n<sizeof($arr2)+1; ++$blockset_n) { $myobj = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET[$blockset_n]"); $myarr = $myobj->nodeset; $blockset_type = $myarr[0]->getattr("type"); // $obj3 = xpath_eval($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET[$blockset_n]/BLOCKSETELEMENT"); $arr3 = $obj3->nodeset; $blocksetelements = array(); for($blocksetelement_n=1; $blocksetelement_n<sizeof($arr3)+1; ++$blocksetelement_n) { $blocksetelement_vars = xml_parse_vars($ctx, "//DOC/BLOCKS/BLOCK[$block_n]/BLOCKSET[$blockset_n]/BLOCKSETELEMENT[$blocksetelement_n]/VAR"); $blocksetelements[] = $blocksetelement_vars; } //$blocksets[$blockset_type] = array(array("sa"=>"as"),array("s2"=>"a2")); $blocksets[$blockset_type] = $blocksetelements; } $blocks[] = array_merge($block_vars, $blocksets); } $blocks_arr = array("BLOCKS"=>$blocks); $doc_v = array_merge($doc_vars, $blocks_arr); } function xml_parse_vars($ctx,$path) { $obj = xpath_eval($ctx, $path); $arr = $obj->nodeset; if($path == "//DOC/BLOCKS/BLOCK[1]/BLOCKSET[2]/BLOCKSETELEMENT[1]/VAR") { print_r($arr); } for($x=0; $x<sizeof($arr); ++$x) { $name = $arr[$x]->getattr("name"); $value = $arr[$x]->content; $results[$name] = $value; } return $results; } //function XML_Def_Parse("kulichki.xml"); ?> ------------------------------------------------------- This is "kulichki.xml": ------------------------------------------------------ <?xml version="1.0"?> <DOC version="1.0" copyright="(c) Denis Torbichuk, 2000"> <VAR name="DOC_CODE">KULICHKI.TV</VAR> <VAR name="DOC_DESC">Программа телепередач на Kulichki</VAR> <VAR name="DOC_URL">tv6.htm</VAR> <BLOCKS> <BLOCK number="1"> <VAR name="BLOCK_DESC">Общий блок</VAR> <VAR name="BLOCK_BEGIN"></VAR> <VAR name="BLOCK_END"></VAR> <BLOCKSET type="SINGLE"> </BLOCKSET> <BLOCKSET type="MULTIPLE"> <BLOCKSETELEMENT> <!-- <P><FONT SIZE=+2><B>Понедельник. 09 Апреля. 41 КАНАЛ<br></B></FONT><HR> --> <VAR name="EL_DESC">Канал/день</VAR> <VAR name="EL_PATTERN_BEGIN"/> <VAR name="EL_PATTERN"><![CDATA[<P>.*?<FONT.*?><B>{%%:day}. {%%:day} {%%:month}. {%%:channel}<br>.*?<HR>.*?<pre>{%%:programs}</pre>]]></VAR> <VAR name="EL_PATTERN_END"/> </BLOCKSETELEMENT> </BLOCKSET> </BLOCK> </BLOCKS> </DOC> ----------------------------------------------------- This script output in PHP 4.04 (it is right): X-Powered-By: PHP/4.0.4 Content-type: text/html Array ( [0] => DomNode Object ( [type] => 1 [name] => VAR [content] => Канал/день [node] => Resource id #24 ) [1] => DomNode Object ( [type] => 1 [name] => VAR [node] => Resource id #25 ) [2] => DomNode Object ( [type] => 1 [name] => VAR [content] => <P>.*?<FONT.*?><B>{%%:day}. {%%:day} {%%:month}. {%%:channel}<br>.*?<HR>.*?<pre>{%%:programs}</pre> [node] => Resource id #26 ) [3] => DomNode Object ( [type] => 1 [name] => VAR [node] => Resource id #27 ) ) But this is output from PHP 4.05 (it is wrong): X-Powered-By: PHP/4.0.5 Content-type: text/html Array ( [0] => DomNode Object ( [type] => 1 [name] => VAR [content] => Канал/день [node] => Resource id #24 ) [1] => DomNode Object ( [type] => 1 [name] => VAR [content] => [node] => Resource id #25 ) [2] => DomNode Object ( [type] => 1 [name] => VAR [content] => [node] => Resource id #26 ) [3] => DomNode Object ( [type] => 1 [name] => VAR [content] => [node] => Resource id #27 ) ) ----- As you see my CDATA node content is empty in PHP 4.05 case. Why? It is bug? When I insert text in node instead CDATA it is works. Can you explain me problem? P.S. I'm using PHP 4.04 & PHP 4.05 on WinNT (W2k) platform. Thanks. Sincerely yours, Denis Torbichuk. [EMAIL PROTECTED] ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=10994&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]