#41172 [Fbk->Csd]: SimpleXML empty attributes
| From: | fedelman at gmail dot com | Date: | Tue, 24 Apr 2007 14:05:27 +0000 |
| Subject: | #41172 [Fbk->Csd]: SimpleXML empty attributes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-111852@lists.php.net to get a copy of this message | ||
ID: 41172
User updated by: fedelman at gmail dot com
Reported By: fedelman at gmail dot com
-Status: Feedback
+Status: Closed
Bug Type: DOM XML related
Operating System: *
PHP Version: 5.2.1
New Comment:
There is no bug. It's my mistake. Cannot dump full internal object
SimpleXMLElement.
Previous Comments:
------------------------------------------------------------------------
[2007-04-23 17:42:26] helly@php.net
Try: var_dump($oXML[0]);
------------------------------------------------------------------------
[2007-04-23 15:41:14] fedelman at gmail dot com
Description:
------------
When I've got a node with one attribute and text, the SimpleXML does
not return the attribute, it only return the text.
Please, see the example.
I think may be it's this is a bug.
Reproduce code:
---------------
$strXml = "
<root>
<data myattr=\"This is the value\">This is the text</data>
</root>";
$oXML=simplexml_load_string($strXml);
echo "<pre>";
var_dump($oXML);
echo "</pre>";
Expected result:
----------------
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["myattr1"]=>
string(17) "This is the value"
}
string(16) "This is the text"
}
Actual result:
--------------
object(SimpleXMLElement)#1 (1) {
["data"]=>
string(16) "This is the text"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41172&edit=1