Bug #66044 [Opn->Nab]: SimpleXMLElement::children

From: Date: Thu, 07 Nov 2013 18:19:44 +0000
Subject: Bug #66044 [Opn->Nab]: SimpleXMLElement::children
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182635@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66044&edit=1 ID: 66044 Updated by: requinix@php.net Reported by: contact at cosminsandu dot ro Summary: SimpleXMLElement::children -Status: Open +Status: Not a bug Type: Bug Package: SimpleXML related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php children() and attributes(), as well as ->, will only return children/attributes of the "current namespace", which uses the default of xmlns="". To switch namespaces pass arguments. $xml = new SimpleXMLElement("your XML", 0, false); $body_node = $xml->children("soap", true)->Body; $login_node = $body_node->children("q1", true)->login; $user_node = $login_node->children("")->user; Previous Comments: ------------------------------------------------------------------------ [2013-11-07 09:49:17] contact at cosminsandu dot ro Description: ------------ the SimpleXMLElement::children does not return correct children(s) if the namespace is defined in child element Test script: --------------- http://stackoverflow.com/questions/19832026/php-simplexmlelement-get-children-with-another-xml-namespace Expected result: ---------------- the q1 element: <q1:login xmlns:q1="THE NAMESPACE I NEED"> <user xsi:type="xsd:string">user</user> <password xsi:type="xsd:string">pass</password> </q1:login> Actual result: -------------- the $body_node->count() return 0; and $body_node->children()->asXML() returns false. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66044&edit=1

« previous php.bugs (#182635) next »