mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
For rationale, see #6787 Extensions migrated in part 4: * simplexml * skeleton * soap * spl * sqlite3 * sysvmsg * sysvsem * tidy - also removed a check for an ancient dependency version
35 lines
795 B
PHP
35 lines
795 B
PHP
--TEST--
|
|
Bug #45553 (Using XPath to return values for attributes with a namespace does not work)
|
|
--EXTENSIONS--
|
|
simplexml
|
|
--FILE--
|
|
<?php
|
|
$xml =<<<XML
|
|
<xml xmlns:a="http://a">
|
|
<data a:label="I am A" label="I am Nothing">test1</data>
|
|
<a:data a:label="I am a:A" label="I am a:Nothing">test2</a:data>
|
|
</xml>
|
|
XML;
|
|
|
|
$x = simplexml_load_string($xml);
|
|
$x->registerXPathNamespace("a", "http://a");
|
|
|
|
$atts = $x->xpath("/xml/data/@a:label");
|
|
echo $atts[0] . "\n";
|
|
$atts = $x->xpath("/xml/a:data");
|
|
echo $atts[0]->attributes() . "\n";
|
|
$atts = $x->xpath("/xml/a:data/@a:label");
|
|
echo $atts[0] . "\n";
|
|
$atts = $x->xpath("/xml/a:data/@label");
|
|
echo $atts[0] . "\n";
|
|
$atts = $x->xpath("/xml/data/@label");
|
|
echo $atts[0] . "\n";
|
|
?>
|
|
--EXPECT--
|
|
I am A
|
|
I am a:Nothing
|
|
I am a:A
|
|
I am a:Nothing
|
|
I am Nothing
|
|
|