#37035 [NEW]: Fail to produce a SimpleXML Object with namespace in root element
| From: | mir at datanom dot net | Date: | Mon, 10 Apr 2006 23:13:13 +0000 |
| Subject: | #37035 [NEW]: Fail to produce a SimpleXML Object with namespace in root element | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-95570@lists.php.net to get a copy of this message | ||
From: mir at datanom dot net
Operating system: GNU/Linux
PHP version: 5.1.2
PHP Bug Type: SimpleXML related
Bug description: Fail to produce a SimpleXML Object with namespace in root element
Description:
------------
Given this xml document simplexml_load_string and simplexml_load_file
returns false
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<businessList
generic="2.0" operator="ms.com" truncated="false"
xmlns="urn:uddi-org:api_v2">
<businessInfos>
<businessInfo businessKey="c13cc7b2-642d-41d0-b2dd-7bb531a18997">
<name xml:lang="en">Microsoft DRMS Dev</name>
<serviceInfos>
<serviceInfo
serviceKey="6166f8b2-436d-4001-9f68-f37ff8b47ea3"
businessKey="c13cc7b2-642d-41d0-b2dd-7bb531a18997">
<name xml:lang="en">Certification</name>
</serviceInfo>
</serviceInfos>
</businessInfo>
</businessInfos>
</businessList>
</soap:Body>
</soap:Envelope>
If I erase namespace references from the root element a valid simpleXML
object is returned:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope>
<soap:Body>
<businessList
generic="2.0" operator="ms.com" truncated="false"
xmlns="urn:uddi-org:api_v2">
<businessInfos>
<businessInfo businessKey="c13cc7b2-642d-41d0-b2dd-7bb531a18997">
<name xml:lang="en">Microsoft DRMS Dev</name>
<serviceInfos>
<serviceInfo
serviceKey="6166f8b2-436d-4001-9f68-f37ff8b47ea3"
businessKey="c13cc7b2-642d-41d0-b2dd-7bb531a18997">
<name xml:lang="en">Certification</name>
</serviceInfo>
</serviceInfos>
</businessInfo>
</businessInfos>
</businessList>
</soap:Body>
</soap:Envelope>
Reproduce code:
---------------
class xmlParser
{
private $document;
public function __construct($xml)
{
$this->document =
simplexml_load_string((string)$xml);
if (!$this->document)
throw new xmlParserException("The XML document is not well-formed: \n" .
$xml);
}
}
Expected result:
----------------
A SimpleXML Object
--
Edit bug report at http://bugs.php.net/?id=37035&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37035&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37035&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37035&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37035&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37035&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37035&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37035&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37035&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37035&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37035&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37035&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37035&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37035&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37035&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37035&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37035&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37035&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37035&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37035&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37035&r=mysqlcfg