#31846 [Opn->Bgs]: simplexml_load_string doesn't get root node

From: Date: Mon, 07 Feb 2005 15:37:05 +0000
Subject: #31846 [Opn->Bgs]: simplexml_load_string doesn't get root node
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73603@lists.php.net to get a copy of this message
ID: 31846 Updated by: chregu@php.net Reported By: andrew at shh dot fi -Status: Open +Status: Bogus Bug Type: SimpleXML related Operating System: win32 PHP Version: 5.0.3 New Comment: This is correct. print_r shows you the children nodes of the choosen node. in your code, $simple *is* the root node. I don't see anything wrong. There's no such thing as SimpleXMLDocument Object in SimpleXML. And yes, there is no way of getting the name of the root tag. Use DOM if you need that. Previous Comments: ------------------------------------------------------------------------ [2005-02-04 16:28:06] andrew at shh dot fi Description: ------------ $xml = simplexml_load_string($xml_str) returns all tags correctly except the root node. There appears to be NO WAY to get the the name of the root tag Reproduce code: --------------- $xml = '<?xml version="1.0" encoding="ISO-8859-1"?><article><title>Hello</title></article>'; $simple = simplexml_load_string($xml); print_r($simple); Expected result: ---------------- The object should include the root tag, except it starts from child of the root ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31846&edit=1

« previous php.bugs (#73603) next »