Annotation of embedaddon/php/ext/tidy/tests/012.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Accessing children nodes
3: --SKIPIF--
4: <?php if (!extension_loaded("tidy")) print "skip"; ?>
5: --FILE--
6: <?php
7:
8: function dump_nodes(tidyNode $node) {
9:
10: var_dump($node->hasChildren());
11: if($node->hasChildren()) {
12:
13: foreach($node->child as $c) {
14:
15: var_dump($c);
16:
17: if($c->hasChildren()) {
18:
19: dump_nodes($c);
20:
21: }
22: }
23:
24: }
25:
26: }
27:
28: $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>", array('newline' => 'LF'));
29: $html = $a->html();
30: dump_nodes($html);
31:
32: ?>
33: --EXPECT--
34: bool(true)
35: object(tidyNode)#3 (9) {
36: ["value"]=>
37: string(31) "<head>
38: <title></title>
39: </head>
40: "
41: ["name"]=>
42: string(4) "head"
43: ["type"]=>
44: int(5)
45: ["line"]=>
46: int(1)
47: ["column"]=>
48: int(7)
49: ["proprietary"]=>
50: bool(false)
51: ["id"]=>
52: int(46)
53: ["attribute"]=>
54: NULL
55: ["child"]=>
56: array(1) {
57: [0]=>
58: &object(tidyNode)#4 (9) {
59: ["value"]=>
60: string(16) "<title></title>
61: "
62: ["name"]=>
63: string(5) "title"
64: ["type"]=>
65: int(5)
66: ["line"]=>
67: int(1)
68: ["column"]=>
69: int(87)
70: ["proprietary"]=>
71: bool(false)
72: ["id"]=>
73: int(111)
74: ["attribute"]=>
75: NULL
76: ["child"]=>
77: NULL
78: }
79: }
80: }
81: bool(true)
82: object(tidyNode)#4 (9) {
83: ["value"]=>
84: string(16) "<title></title>
85: "
86: ["name"]=>
87: string(5) "title"
88: ["type"]=>
89: int(5)
90: ["line"]=>
91: int(1)
92: ["column"]=>
93: int(87)
94: ["proprietary"]=>
95: bool(false)
96: ["id"]=>
97: int(111)
98: ["attribute"]=>
99: NULL
100: ["child"]=>
101: NULL
102: }
103: object(tidyNode)#5 (9) {
104: ["value"]=>
105: string(80) "<body bgcolor="#FFFFFF" alink="#000000">
106: <b>Hi</b><i>Bye<u>Test</u></i>
107: </body>
108: "
109: ["name"]=>
110: string(4) "body"
111: ["type"]=>
112: int(5)
113: ["line"]=>
114: int(1)
115: ["column"]=>
116: int(7)
117: ["proprietary"]=>
118: bool(false)
119: ["id"]=>
120: int(16)
121: ["attribute"]=>
122: array(2) {
123: ["bgcolor"]=>
124: string(7) "#FFFFFF"
125: ["alink"]=>
126: string(7) "#000000"
127: }
128: ["child"]=>
129: array(2) {
130: [0]=>
131: &object(tidyNode)#6 (9) {
132: ["value"]=>
133: string(9) "<b>Hi</b>"
134: ["name"]=>
135: string(1) "b"
136: ["type"]=>
137: int(5)
138: ["line"]=>
139: int(1)
140: ["column"]=>
141: int(43)
142: ["proprietary"]=>
143: bool(false)
144: ["id"]=>
145: int(8)
146: ["attribute"]=>
147: NULL
148: ["child"]=>
149: array(1) {
150: [0]=>
151: &object(tidyNode)#7 (8) {
152: ["value"]=>
153: string(2) "Hi"
154: ["name"]=>
155: string(0) ""
156: ["type"]=>
157: int(4)
158: ["line"]=>
159: int(1)
160: ["column"]=>
161: int(46)
162: ["proprietary"]=>
163: bool(false)
164: ["attribute"]=>
165: NULL
166: ["child"]=>
167: NULL
168: }
169: }
170: }
171: [1]=>
172: &object(tidyNode)#8 (9) {
173: ["value"]=>
174: string(21) "<i>Bye<u>Test</u></i>"
175: ["name"]=>
176: string(1) "i"
177: ["type"]=>
178: int(5)
179: ["line"]=>
180: int(1)
181: ["column"]=>
182: int(52)
183: ["proprietary"]=>
184: bool(false)
185: ["id"]=>
186: int(49)
187: ["attribute"]=>
188: NULL
189: ["child"]=>
190: array(2) {
191: [0]=>
192: &object(tidyNode)#9 (8) {
193: ["value"]=>
194: string(3) "Bye"
195: ["name"]=>
196: string(0) ""
197: ["type"]=>
198: int(4)
199: ["line"]=>
200: int(1)
201: ["column"]=>
202: int(55)
203: ["proprietary"]=>
204: bool(false)
205: ["attribute"]=>
206: NULL
207: ["child"]=>
208: NULL
209: }
210: [1]=>
211: &object(tidyNode)#10 (9) {
212: ["value"]=>
213: string(11) "<u>Test</u>"
214: ["name"]=>
215: string(1) "u"
216: ["type"]=>
217: int(5)
218: ["line"]=>
219: int(1)
220: ["column"]=>
221: int(58)
222: ["proprietary"]=>
223: bool(false)
224: ["id"]=>
225: int(114)
226: ["attribute"]=>
227: NULL
228: ["child"]=>
229: array(1) {
230: [0]=>
231: &object(tidyNode)#11 (8) {
232: ["value"]=>
233: string(4) "Test"
234: ["name"]=>
235: string(0) ""
236: ["type"]=>
237: int(4)
238: ["line"]=>
239: int(1)
240: ["column"]=>
241: int(61)
242: ["proprietary"]=>
243: bool(false)
244: ["attribute"]=>
245: NULL
246: ["child"]=>
247: NULL
248: }
249: }
250: }
251: }
252: }
253: }
254: }
255: bool(true)
256: object(tidyNode)#6 (9) {
257: ["value"]=>
258: string(9) "<b>Hi</b>"
259: ["name"]=>
260: string(1) "b"
261: ["type"]=>
262: int(5)
263: ["line"]=>
264: int(1)
265: ["column"]=>
266: int(43)
267: ["proprietary"]=>
268: bool(false)
269: ["id"]=>
270: int(8)
271: ["attribute"]=>
272: NULL
273: ["child"]=>
274: array(1) {
275: [0]=>
276: &object(tidyNode)#7 (8) {
277: ["value"]=>
278: string(2) "Hi"
279: ["name"]=>
280: string(0) ""
281: ["type"]=>
282: int(4)
283: ["line"]=>
284: int(1)
285: ["column"]=>
286: int(46)
287: ["proprietary"]=>
288: bool(false)
289: ["attribute"]=>
290: NULL
291: ["child"]=>
292: NULL
293: }
294: }
295: }
296: bool(true)
297: object(tidyNode)#7 (8) {
298: ["value"]=>
299: string(2) "Hi"
300: ["name"]=>
301: string(0) ""
302: ["type"]=>
303: int(4)
304: ["line"]=>
305: int(1)
306: ["column"]=>
307: int(46)
308: ["proprietary"]=>
309: bool(false)
310: ["attribute"]=>
311: NULL
312: ["child"]=>
313: NULL
314: }
315: object(tidyNode)#8 (9) {
316: ["value"]=>
317: string(21) "<i>Bye<u>Test</u></i>"
318: ["name"]=>
319: string(1) "i"
320: ["type"]=>
321: int(5)
322: ["line"]=>
323: int(1)
324: ["column"]=>
325: int(52)
326: ["proprietary"]=>
327: bool(false)
328: ["id"]=>
329: int(49)
330: ["attribute"]=>
331: NULL
332: ["child"]=>
333: array(2) {
334: [0]=>
335: &object(tidyNode)#9 (8) {
336: ["value"]=>
337: string(3) "Bye"
338: ["name"]=>
339: string(0) ""
340: ["type"]=>
341: int(4)
342: ["line"]=>
343: int(1)
344: ["column"]=>
345: int(55)
346: ["proprietary"]=>
347: bool(false)
348: ["attribute"]=>
349: NULL
350: ["child"]=>
351: NULL
352: }
353: [1]=>
354: &object(tidyNode)#10 (9) {
355: ["value"]=>
356: string(11) "<u>Test</u>"
357: ["name"]=>
358: string(1) "u"
359: ["type"]=>
360: int(5)
361: ["line"]=>
362: int(1)
363: ["column"]=>
364: int(58)
365: ["proprietary"]=>
366: bool(false)
367: ["id"]=>
368: int(114)
369: ["attribute"]=>
370: NULL
371: ["child"]=>
372: array(1) {
373: [0]=>
374: &object(tidyNode)#11 (8) {
375: ["value"]=>
376: string(4) "Test"
377: ["name"]=>
378: string(0) ""
379: ["type"]=>
380: int(4)
381: ["line"]=>
382: int(1)
383: ["column"]=>
384: int(61)
385: ["proprietary"]=>
386: bool(false)
387: ["attribute"]=>
388: NULL
389: ["child"]=>
390: NULL
391: }
392: }
393: }
394: }
395: }
396: bool(true)
397: object(tidyNode)#9 (8) {
398: ["value"]=>
399: string(3) "Bye"
400: ["name"]=>
401: string(0) ""
402: ["type"]=>
403: int(4)
404: ["line"]=>
405: int(1)
406: ["column"]=>
407: int(55)
408: ["proprietary"]=>
409: bool(false)
410: ["attribute"]=>
411: NULL
412: ["child"]=>
413: NULL
414: }
415: object(tidyNode)#10 (9) {
416: ["value"]=>
417: string(11) "<u>Test</u>"
418: ["name"]=>
419: string(1) "u"
420: ["type"]=>
421: int(5)
422: ["line"]=>
423: int(1)
424: ["column"]=>
425: int(58)
426: ["proprietary"]=>
427: bool(false)
428: ["id"]=>
429: int(114)
430: ["attribute"]=>
431: NULL
432: ["child"]=>
433: array(1) {
434: [0]=>
435: &object(tidyNode)#11 (8) {
436: ["value"]=>
437: string(4) "Test"
438: ["name"]=>
439: string(0) ""
440: ["type"]=>
441: int(4)
442: ["line"]=>
443: int(1)
444: ["column"]=>
445: int(61)
446: ["proprietary"]=>
447: bool(false)
448: ["attribute"]=>
449: NULL
450: ["child"]=>
451: NULL
452: }
453: }
454: }
455: bool(true)
456: object(tidyNode)#11 (8) {
457: ["value"]=>
458: string(4) "Test"
459: ["name"]=>
460: string(0) ""
461: ["type"]=>
462: int(4)
463: ["line"]=>
464: int(1)
465: ["column"]=>
466: int(61)
467: ["proprietary"]=>
468: bool(false)
469: ["attribute"]=>
470: NULL
471: ["child"]=>
472: NULL
473: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>