2005-10-31 19:09:13 +00:00
|
|
|
--TEST--
|
|
|
|
SimpleXML: getting namespaces
|
|
|
|
--SKIPIF--
|
|
|
|
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
2006-08-08 20:52:45 +00:00
|
|
|
$xml =b<<<EOF
|
2005-10-31 19:09:13 +00:00
|
|
|
<?xml version='1.0'?>
|
|
|
|
<xhtml:html xmlns:html='http://www.w3.org/1999/xhtml' xmlns:xhtml='http://www.w3.org/TR/REC-html40'>
|
2005-11-01 23:21:29 +00:00
|
|
|
<xhtml:head><xhtml:title xmlns:xhtml='http://www.w3.org/TR/REC-html401'>bla</xhtml:title></xhtml:head>
|
2005-10-31 19:09:13 +00:00
|
|
|
<xhtml:body html:title="b">
|
|
|
|
<html:h1>bla</html:h1>
|
|
|
|
<foo:bar xmlns:foo='foobar' xmlns:baz='foobarbaz'/>
|
|
|
|
</xhtml:body>
|
|
|
|
</xhtml:html>
|
|
|
|
EOF;
|
|
|
|
|
|
|
|
$sxe = simplexml_load_string($xml);
|
|
|
|
|
|
|
|
var_dump($sxe->getNamespaces());
|
|
|
|
var_dump($sxe->getNamespaces(true));
|
|
|
|
var_dump($sxe->getDocNamespaces());
|
|
|
|
var_dump($sxe->getDocNamespaces(true));
|
|
|
|
|
2006-08-08 20:52:45 +00:00
|
|
|
$xml =b<<<EOF
|
2005-11-01 11:53:14 +00:00
|
|
|
<?xml version='1.0'?>
|
2005-11-01 23:21:29 +00:00
|
|
|
<html xmlns='http://www.w3.org/1999/xhtml'>
|
|
|
|
<head><title xmlns='http://www.w3.org/TR/REC-html40'>bla</title></head>
|
|
|
|
</html>
|
2005-11-01 11:53:14 +00:00
|
|
|
EOF;
|
|
|
|
|
|
|
|
$sxe = simplexml_load_string($xml);
|
|
|
|
|
|
|
|
var_dump($sxe->getNamespaces());
|
|
|
|
var_dump($sxe->getDocNamespaces());
|
|
|
|
|
2006-08-08 20:52:45 +00:00
|
|
|
$xml =b<<<EOF
|
2005-11-01 11:55:13 +00:00
|
|
|
<?xml version='1.0'?>
|
|
|
|
<root/>
|
|
|
|
EOF;
|
|
|
|
|
|
|
|
$sxe = simplexml_load_string($xml);
|
|
|
|
|
|
|
|
var_dump($sxe->getNamespaces());
|
|
|
|
var_dump($sxe->getDocNamespaces());
|
|
|
|
|
2005-10-31 19:09:13 +00:00
|
|
|
?>
|
|
|
|
===DONE===
|
2005-11-01 11:53:14 +00:00
|
|
|
<?php exit(0); ?>
|
2005-10-31 19:09:13 +00:00
|
|
|
--EXPECTF--
|
|
|
|
array(1) {
|
|
|
|
["xhtml"]=>
|
|
|
|
string(31) "http://www.w3.org/TR/REC-html40"
|
|
|
|
}
|
|
|
|
array(3) {
|
|
|
|
["xhtml"]=>
|
|
|
|
string(31) "http://www.w3.org/TR/REC-html40"
|
|
|
|
["html"]=>
|
|
|
|
string(28) "http://www.w3.org/1999/xhtml"
|
|
|
|
["foo"]=>
|
|
|
|
string(6) "foobar"
|
|
|
|
}
|
|
|
|
array(2) {
|
|
|
|
["html"]=>
|
|
|
|
string(28) "http://www.w3.org/1999/xhtml"
|
|
|
|
["xhtml"]=>
|
|
|
|
string(31) "http://www.w3.org/TR/REC-html40"
|
|
|
|
}
|
|
|
|
array(4) {
|
|
|
|
["html"]=>
|
|
|
|
string(28) "http://www.w3.org/1999/xhtml"
|
|
|
|
["xhtml"]=>
|
|
|
|
string(31) "http://www.w3.org/TR/REC-html40"
|
|
|
|
["foo"]=>
|
|
|
|
string(6) "foobar"
|
|
|
|
["baz"]=>
|
|
|
|
string(9) "foobarbaz"
|
|
|
|
}
|
2005-11-01 11:53:14 +00:00
|
|
|
array(1) {
|
|
|
|
[""]=>
|
|
|
|
string(28) "http://www.w3.org/1999/xhtml"
|
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[""]=>
|
|
|
|
string(28) "http://www.w3.org/1999/xhtml"
|
|
|
|
}
|
2005-11-01 11:55:13 +00:00
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
array(0) {
|
|
|
|
}
|
2005-10-31 19:09:13 +00:00
|
|
|
===DONE===
|
|
|
|
--UEXPECTF--
|
|
|
|
array(1) {
|
|
|
|
[u"xhtml"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(31) "http://www.w3.org/TR/REC-html40"
|
2005-10-31 19:09:13 +00:00
|
|
|
}
|
|
|
|
array(3) {
|
|
|
|
[u"xhtml"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(31) "http://www.w3.org/TR/REC-html40"
|
2005-10-31 19:09:13 +00:00
|
|
|
[u"html"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(28) "http://www.w3.org/1999/xhtml"
|
2005-10-31 19:09:13 +00:00
|
|
|
[u"foo"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(6) "foobar"
|
2005-10-31 19:09:13 +00:00
|
|
|
}
|
|
|
|
array(2) {
|
|
|
|
[u"html"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(28) "http://www.w3.org/1999/xhtml"
|
2005-10-31 19:09:13 +00:00
|
|
|
[u"xhtml"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(31) "http://www.w3.org/TR/REC-html40"
|
2005-10-31 19:09:13 +00:00
|
|
|
}
|
|
|
|
array(4) {
|
|
|
|
[u"html"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(28) "http://www.w3.org/1999/xhtml"
|
2005-10-31 19:09:13 +00:00
|
|
|
[u"xhtml"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(31) "http://www.w3.org/TR/REC-html40"
|
2005-10-31 19:09:13 +00:00
|
|
|
[u"foo"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(6) "foobar"
|
2005-10-31 19:09:13 +00:00
|
|
|
[u"baz"]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(9) "foobarbaz"
|
2005-10-31 19:09:13 +00:00
|
|
|
}
|
2005-11-01 11:53:14 +00:00
|
|
|
array(1) {
|
|
|
|
[u""]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(28) "http://www.w3.org/1999/xhtml"
|
2005-11-01 11:53:14 +00:00
|
|
|
}
|
|
|
|
array(1) {
|
|
|
|
[u""]=>
|
2006-08-08 20:52:45 +00:00
|
|
|
unicode(28) "http://www.w3.org/1999/xhtml"
|
2005-11-01 11:53:14 +00:00
|
|
|
}
|
2005-11-01 11:55:13 +00:00
|
|
|
array(0) {
|
|
|
|
}
|
|
|
|
array(0) {
|
|
|
|
}
|
2005-10-31 19:09:13 +00:00
|
|
|
===DONE===
|