010.phpt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. --TEST--
  2. Accessing root, body, html, and head nodes..
  3. --EXTENSIONS--
  4. tidy
  5. --FILE--
  6. <?php
  7. $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>", array('newline' => 'LF'));
  8. var_dump($a->root());
  9. var_dump($a->body());
  10. var_dump($a->html());
  11. var_dump($a->head());
  12. ?>
  13. --EXPECTF--
  14. object(tidyNode)#2 (8) {
  15. ["value"]=>
  16. string(94) "<html>
  17. <head>
  18. <title></title>
  19. </head>
  20. <body bgcolor="#FFFFFF" alink="#000000">
  21. </body>
  22. </html>"
  23. ["name"]=>
  24. string(0) ""
  25. ["type"]=>
  26. int(0)
  27. ["line"]=>
  28. int(1)
  29. ["column"]=>
  30. int(1)
  31. ["proprietary"]=>
  32. bool(false)
  33. ["attribute"]=>
  34. NULL
  35. ["child"]=>
  36. array(1) {
  37. [0]=>
  38. object(tidyNode)#3 (9) {
  39. ["value"]=>
  40. string(94) "<html>
  41. <head>
  42. <title></title>
  43. </head>
  44. <body bgcolor="#FFFFFF" alink="#000000">
  45. </body>
  46. </html>"
  47. ["name"]=>
  48. string(4) "html"
  49. ["type"]=>
  50. int(5)
  51. ["line"]=>
  52. int(1)
  53. ["column"]=>
  54. int(1)
  55. ["proprietary"]=>
  56. bool(false)
  57. ["id"]=>
  58. int(48)
  59. ["attribute"]=>
  60. NULL
  61. ["child"]=>
  62. array(2) {
  63. [0]=>
  64. object(tidyNode)#4 (9) {
  65. ["value"]=>
  66. string(31) "<head>
  67. <title></title>
  68. </head>
  69. "
  70. ["name"]=>
  71. string(4) "head"
  72. ["type"]=>
  73. int(5)
  74. ["line"]=>
  75. int(1)
  76. ["column"]=>
  77. int(7)
  78. ["proprietary"]=>
  79. bool(false)
  80. ["id"]=>
  81. int(46)
  82. ["attribute"]=>
  83. NULL
  84. ["child"]=>
  85. array(1) {
  86. [0]=>
  87. object(tidyNode)#5 (9) {
  88. ["value"]=>
  89. string(16) "<title></title>
  90. "
  91. ["name"]=>
  92. string(5) "title"
  93. ["type"]=>
  94. int(5)
  95. ["line"]=>
  96. int(1)
  97. ["column"]=>
  98. int(57)
  99. ["proprietary"]=>
  100. bool(false)
  101. ["id"]=>
  102. int(%i)
  103. ["attribute"]=>
  104. NULL
  105. ["child"]=>
  106. NULL
  107. }
  108. }
  109. }
  110. [1]=>
  111. object(tidyNode)#6 (9) {
  112. ["value"]=>
  113. string(49) "<body bgcolor="#FFFFFF" alink="#000000">
  114. </body>
  115. "
  116. ["name"]=>
  117. string(4) "body"
  118. ["type"]=>
  119. int(5)
  120. ["line"]=>
  121. int(1)
  122. ["column"]=>
  123. int(7)
  124. ["proprietary"]=>
  125. bool(false)
  126. ["id"]=>
  127. int(16)
  128. ["attribute"]=>
  129. array(2) {
  130. ["bgcolor"]=>
  131. string(7) "#FFFFFF"
  132. ["alink"]=>
  133. string(7) "#000000"
  134. }
  135. ["child"]=>
  136. NULL
  137. }
  138. }
  139. }
  140. }
  141. }
  142. object(tidyNode)#2 (9) {
  143. ["value"]=>
  144. string(49) "<body bgcolor="#FFFFFF" alink="#000000">
  145. </body>
  146. "
  147. ["name"]=>
  148. string(4) "body"
  149. ["type"]=>
  150. int(5)
  151. ["line"]=>
  152. int(1)
  153. ["column"]=>
  154. int(7)
  155. ["proprietary"]=>
  156. bool(false)
  157. ["id"]=>
  158. int(16)
  159. ["attribute"]=>
  160. array(2) {
  161. ["bgcolor"]=>
  162. string(7) "#FFFFFF"
  163. ["alink"]=>
  164. string(7) "#000000"
  165. }
  166. ["child"]=>
  167. NULL
  168. }
  169. object(tidyNode)#2 (9) {
  170. ["value"]=>
  171. string(94) "<html>
  172. <head>
  173. <title></title>
  174. </head>
  175. <body bgcolor="#FFFFFF" alink="#000000">
  176. </body>
  177. </html>"
  178. ["name"]=>
  179. string(4) "html"
  180. ["type"]=>
  181. int(5)
  182. ["line"]=>
  183. int(1)
  184. ["column"]=>
  185. int(1)
  186. ["proprietary"]=>
  187. bool(false)
  188. ["id"]=>
  189. int(48)
  190. ["attribute"]=>
  191. NULL
  192. ["child"]=>
  193. array(2) {
  194. [0]=>
  195. object(tidyNode)#3 (9) {
  196. ["value"]=>
  197. string(31) "<head>
  198. <title></title>
  199. </head>
  200. "
  201. ["name"]=>
  202. string(4) "head"
  203. ["type"]=>
  204. int(5)
  205. ["line"]=>
  206. int(1)
  207. ["column"]=>
  208. int(7)
  209. ["proprietary"]=>
  210. bool(false)
  211. ["id"]=>
  212. int(46)
  213. ["attribute"]=>
  214. NULL
  215. ["child"]=>
  216. array(1) {
  217. [0]=>
  218. object(tidyNode)#6 (9) {
  219. ["value"]=>
  220. string(16) "<title></title>
  221. "
  222. ["name"]=>
  223. string(5) "title"
  224. ["type"]=>
  225. int(5)
  226. ["line"]=>
  227. int(1)
  228. ["column"]=>
  229. int(57)
  230. ["proprietary"]=>
  231. bool(false)
  232. ["id"]=>
  233. int(%i)
  234. ["attribute"]=>
  235. NULL
  236. ["child"]=>
  237. NULL
  238. }
  239. }
  240. }
  241. [1]=>
  242. object(tidyNode)#4 (9) {
  243. ["value"]=>
  244. string(49) "<body bgcolor="#FFFFFF" alink="#000000">
  245. </body>
  246. "
  247. ["name"]=>
  248. string(4) "body"
  249. ["type"]=>
  250. int(5)
  251. ["line"]=>
  252. int(1)
  253. ["column"]=>
  254. int(7)
  255. ["proprietary"]=>
  256. bool(false)
  257. ["id"]=>
  258. int(16)
  259. ["attribute"]=>
  260. array(2) {
  261. ["bgcolor"]=>
  262. string(7) "#FFFFFF"
  263. ["alink"]=>
  264. string(7) "#000000"
  265. }
  266. ["child"]=>
  267. NULL
  268. }
  269. }
  270. }
  271. object(tidyNode)#2 (9) {
  272. ["value"]=>
  273. string(31) "<head>
  274. <title></title>
  275. </head>
  276. "
  277. ["name"]=>
  278. string(4) "head"
  279. ["type"]=>
  280. int(5)
  281. ["line"]=>
  282. int(1)
  283. ["column"]=>
  284. int(7)
  285. ["proprietary"]=>
  286. bool(false)
  287. ["id"]=>
  288. int(46)
  289. ["attribute"]=>
  290. NULL
  291. ["child"]=>
  292. array(1) {
  293. [0]=>
  294. object(tidyNode)#4 (9) {
  295. ["value"]=>
  296. string(16) "<title></title>
  297. "
  298. ["name"]=>
  299. string(5) "title"
  300. ["type"]=>
  301. int(5)
  302. ["line"]=>
  303. int(1)
  304. ["column"]=>
  305. int(57)
  306. ["proprietary"]=>
  307. bool(false)
  308. ["id"]=>
  309. int(%i)
  310. ["attribute"]=>
  311. NULL
  312. ["child"]=>
  313. NULL
  314. }
  315. }
  316. }