#30920 [Opn->Bgs]: SimpleXML : tags with "xs:" prefix
| From: | chregu@php.net | Date: | Sun, 28 Nov 2004 11:07:22 +0000 |
| Subject: | #30920 [Opn->Bgs]: SimpleXML : tags with "xs:" prefix | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-69544@lists.php.net to get a copy of this message | ||
ID: 30920
Updated by: chregu@php.net
Reported By: hieu at laposte dot net
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: windows xp
PHP Version: 5.0.2
New Comment:
print_r and var_dump don't work reliably on simplexml objects... do
*not* use them or even rely on them...
And see http://www.zend.com/php5/articles/php5-simplexml.php
for more
info about SimpleXML and Namespaces
Previous Comments:
------------------------------------------------------------------------
[2004-11-27 17:55:59] hieu at laposte dot net
Description:
------------
When the xml file contains this "xs:" prefix, the file is not correctly
parsed.
Reproduce code:
---------------
The XML file is :
<?xml version="1.0" encoding="utf-16" ?>
<xs:schema id="ds" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="ds" msdata:IsDataSet="true"
msdata:Locale="fr-FR">
<complexType>
...
</xs:element>
</xs:schema>
Php 5 code :
$oXml = simplexml_load_file($sFileName);
print_r($oXml->element);
// doesn't work, nothing printed...
PS : this code works correctly :
$oXml = simplexml_load_file($sFileName);
$aXml = get_object_vars($oXml);
print_r($aXml['element']);
// ok i can now access the "element".
Expected result:
----------------
SimpleXMLElement Object
(
[complexType] => SimpleXMLElement Object
(
.....
)
)
Actual result:
--------------
SimpleXMLElement Object
(
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30920&edit=1