Annotation of embedaddon/php/ext/simplexml/tests/bug45553.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #45553 (Using XPath to return values for attributes with a namespace does not work)
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("simplexml")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: $xml =<<<XML
! 8: <xml xmlns:a="http://a">
! 9: <data a:label="I am A" label="I am Nothing">test1</data>
! 10: <a:data a:label="I am a:A" label="I am a:Nothing">test2</a:data>
! 11: </xml>
! 12: XML;
! 13:
! 14: $x = simplexml_load_string($xml);
! 15: $x->registerXPathNamespace("a", "http://a");
! 16:
! 17: $atts = $x->xpath("/xml/data/@a:label");
! 18: echo $atts[0] . "\n";
! 19: $atts = $x->xpath("/xml/a:data");
! 20: echo $atts[0]->attributes() . "\n";
! 21: $atts = $x->xpath("/xml/a:data/@a:label");
! 22: echo $atts[0] . "\n";
! 23: $atts = $x->xpath("/xml/a:data/@label");
! 24: echo $atts[0] . "\n";
! 25: $atts = $x->xpath("/xml/data/@label");
! 26: echo $atts[0] . "\n";
! 27: ?>
! 28: ===DONE===
! 29: --EXPECTF--
! 30: I am A
! 31: I am a:Nothing
! 32: I am a:A
! 33: I am a:Nothing
! 34: I am Nothing
! 35: ===DONE===
! 36:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>