#28539 [NEW]: A problem with namespaces in SimpleXML
| From: | j dot uribe at globalforma dot com | Date: | Thu, 27 May 2004 07:14:47 +0000 |
| Subject: | #28539 [NEW]: A problem with namespaces in SimpleXML | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-60059@lists.php.net to get a copy of this message | ||
From: j dot uribe at globalforma dot com
Operating system: XP
PHP version: 5.0.0RC2
PHP Bug Type: SimpleXML related
Bug description: A problem with namespaces in SimpleXML
Description:
------------
Hi!
-When i try access to a tag with namespaces like
<namespace:tag>Content</namespace:tag> i can't do it, if i make a
print_r($xml) i can see that tag, but i can not access to it by
$xml->namespace:tag (this is an error) or $xml->tag
-The only way to solve this is make $m=get_object_vars($xml) so i receive
a array with all the elements so i can access to it, but in the case that
namespace belongs to an attribute like <element
namespace:attrib="something"></element> this is not possible and i can not
access to it.
Thx.
Reproduce code:
---------------
$string="<xml>
<parent element:attrib>
<element:tag>content</element>
</parent>
</xml>";
$xml=simplexml_load_string($string));
print_r($xml->parent);<-this works fine;
print_r($xml->parent->element);
echo "$xml->parent->elementecho "$xml->attrib";";<-these does not
produce
any output.
Expected result:
----------------
I expected to see the content of the <element:tag> but i can not see
anything so i can not see the content of the element attrib.
--
Edit bug report at http://bugs.php.net/?id=28539&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28539&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28539&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28539&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28539&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28539&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28539&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28539&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28539&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28539&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28539&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28539&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28539&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28539&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28539&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28539&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28539&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28539&r=float