php-src/ext/simplexml/tests/profile10.phpt
Sterling Hughes a895106606 update the profile of how namespaces should work after discussions with
shane and rob richards.  there were a lot of race conditions with regards
to the way namespaces have been handled in XML documents so far, this new
method removes the race conditions, and gives me a real reason to add the
children() and attributes() methods.
2004-01-16 22:26:09 +00:00

26 lines
663 B
PHP

--TEST--
SimpleXML [profile]: Accessing two attributes with the same name, but different namespaces
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
<child reserved:attribute="Sample" special:attribute="Test" />
</root>
');
echo $root->child->attributes('reserved')['attribute'];
echo "\n";
echo $root->child->attributes('special')['attribute'];
foreach ($root->child['attribute'] as $attr) {
echo "$attr\n";
}
echo "\n---Done---\n";
?>
--EXPECT--
Sample
Test
---Done---