|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-11-22 03:36 UTC] mfischer@php.net
[2001-11-30 21:00 UTC] mfischer@php.net
[2001-12-01 14:46 UTC] mfischer@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
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. dennis@svitonline.com