Annotation of embedaddon/php/ext/simplexml/tests/025.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SimpleXML: getting namespaces
3: --SKIPIF--
4: <?php if (!extension_loaded("simplexml")) print "skip"; ?>
5: --FILE--
6: <?php
7:
8: $xml =<<<EOF
9: <?xml version='1.0'?>
10: <xhtml:html xmlns:html='http://www.w3.org/1999/xhtml' xmlns:xhtml='http://www.w3.org/TR/REC-html40'>
11: <xhtml:head><xhtml:title xmlns:xhtml='http://www.w3.org/TR/REC-html401'>bla</xhtml:title></xhtml:head>
12: <xhtml:body html:title="b">
13: <html:h1>bla</html:h1>
14: <foo:bar xmlns:foo='foobar' xmlns:baz='foobarbaz'/>
15: </xhtml:body>
16: </xhtml:html>
17: EOF;
18:
19: $sxe = simplexml_load_string($xml);
20:
21: var_dump($sxe->getNamespaces());
22: var_dump($sxe->getNamespaces(true));
23: var_dump($sxe->getDocNamespaces());
24: var_dump($sxe->getDocNamespaces(true));
25:
26: $xml =<<<EOF
27: <?xml version='1.0'?>
28: <html xmlns='http://www.w3.org/1999/xhtml'>
29: <head><title xmlns='http://www.w3.org/TR/REC-html40'>bla</title></head>
30: </html>
31: EOF;
32:
33: $sxe = simplexml_load_string($xml);
34:
35: var_dump($sxe->getNamespaces());
36: var_dump($sxe->getDocNamespaces());
37:
38: $xml =<<<EOF
39: <?xml version='1.0'?>
40: <root/>
41: EOF;
42:
43: $sxe = simplexml_load_string($xml);
44:
45: var_dump($sxe->getNamespaces());
46: var_dump($sxe->getDocNamespaces());
47:
48: ?>
49: ===DONE===
50: <?php exit(0); ?>
51: --EXPECTF--
52: array(1) {
53: ["xhtml"]=>
54: string(31) "http://www.w3.org/TR/REC-html40"
55: }
56: array(3) {
57: ["xhtml"]=>
58: string(31) "http://www.w3.org/TR/REC-html40"
59: ["html"]=>
60: string(28) "http://www.w3.org/1999/xhtml"
61: ["foo"]=>
62: string(6) "foobar"
63: }
64: array(2) {
65: ["html"]=>
66: string(28) "http://www.w3.org/1999/xhtml"
67: ["xhtml"]=>
68: string(31) "http://www.w3.org/TR/REC-html40"
69: }
70: array(4) {
71: ["html"]=>
72: string(28) "http://www.w3.org/1999/xhtml"
73: ["xhtml"]=>
74: string(31) "http://www.w3.org/TR/REC-html40"
75: ["foo"]=>
76: string(6) "foobar"
77: ["baz"]=>
78: string(9) "foobarbaz"
79: }
80: array(1) {
81: [""]=>
82: string(28) "http://www.w3.org/1999/xhtml"
83: }
84: array(1) {
85: [""]=>
86: string(28) "http://www.w3.org/1999/xhtml"
87: }
88: array(0) {
89: }
90: array(0) {
91: }
92: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>