Bug #68267 [Opn->Csd]: Analysis of the problem
| From: | ian dot email at qq dot com | Date: | Mon, 20 Oct 2014 07:26:21 +0000 |
| Subject: | Bug #68267 [Opn->Csd]: Analysis of the problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188193@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68267&edit=1
ID: 68267
User updated by: ian dot email at qq dot com
Reported by: ian dot email at qq dot com
Summary: Analysis of the problem
-Status: Open
+Status: Closed
Type: Bug
Package: DOM XML related
Operating System: win7/centos
PHP Version: 5.6.2
Block user comment: N
Private report: N
New Comment:
Operation problems
Previous Comments:
------------------------------------------------------------------------
[2014-10-20 07:17:15] ian dot email at qq dot com
Description:
------------
<?xml version="1.0" encoding="UTF-8"?>
<web>
<seo>
<theme/>
<keys>keys</keys>
<title>title</title>
<desc>desc</desc>
<banner>banner</banner>
</seo>
<upload>
<img>
<size>1000</size>
<type>
bmp,gif,jpg,png,jpeg
</type>
<show>
thumb:60*60|norm:320*320|zoom:512*512
</show>
</img>
</upload>
</web>
$xml = new \DomDocument('1.0', 'UTF-8');
$xml->load('web.xml');
$notes = $xml->getElementsByTagName('img');
for ($index = 0; $index < $notes->length; $index++) {
foreach ($notes->item($index)->childNodes as $nv){
if($nv->nodeType == XML_ELEMENT_NODE)
echo $nv->nodeName.'=>'.$nv->nodeValue.'<br />';
}
}
Test script:
---------------
<?xml version="1.0" encoding="UTF-8"?>
<web>
<seo>
<theme/>
<keys>keys</keys>
<title>title</title>
<desc>desc</desc>
<banner>banner</banner>
</seo>
<upload>
<img>
<size>1000</size>
<type>
bmp,gif,jpg,png,jpeg
</type>
<show>
thumb:60*60|norm:320*320|zoom:512*512
</show>
</img>
</upload>
</web>
$xml = new \DomDocument('1.0', 'UTF-8');
$xml->load('web.xml');
$notes = $xml->getElementsByTagName('img');
for ($index = 0; $index < $notes->length; $index++) {
foreach ($notes->item($index)->childNodes as $nv){
if($nv->nodeType == XML_ELEMENT_NODE)
echo $nv->nodeName.'=>'.$nv->nodeValue.'<br />';
}
}
Expected result:
----------------
$notes = $xml->getElementsByTagName('img'); Cycle number is wrong
$notes = $xml->getElementsByTagName('size'); Results cannot be obtained
Actual result:
--------------
win7:
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
centOS:
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
size=>1000
type=> bmp,gif,jpg,png,jpeg
show=> thumb:60*60|norm:320*320|zoom:512*512
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68267&edit=1