nokogiri 1.2.3-x86-mswin32-60 → 1.4.5-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (319) hide show
  1. data/.autotest +18 -7
  2. data/.gemtest +0 -0
  3. data/CHANGELOG.ja.rdoc +297 -3
  4. data/CHANGELOG.rdoc +289 -0
  5. data/Manifest.txt +148 -37
  6. data/README.ja.rdoc +20 -20
  7. data/README.rdoc +53 -22
  8. data/Rakefile +127 -211
  9. data/bin/nokogiri +54 -0
  10. data/ext/nokogiri/depend +358 -0
  11. data/ext/nokogiri/extconf.rb +89 -54
  12. data/ext/nokogiri/html_document.c +34 -27
  13. data/ext/nokogiri/html_document.h +1 -1
  14. data/ext/nokogiri/html_element_description.c +276 -0
  15. data/ext/nokogiri/html_element_description.h +10 -0
  16. data/ext/nokogiri/html_entity_lookup.c +7 -5
  17. data/ext/nokogiri/html_entity_lookup.h +1 -1
  18. data/ext/nokogiri/html_sax_parser_context.c +94 -0
  19. data/ext/nokogiri/html_sax_parser_context.h +11 -0
  20. data/ext/nokogiri/{native.c → nokogiri.c} +31 -7
  21. data/ext/nokogiri/{native.h → nokogiri.h} +68 -41
  22. data/ext/nokogiri/xml_attr.c +20 -9
  23. data/ext/nokogiri/xml_attr.h +1 -1
  24. data/ext/nokogiri/xml_attribute_decl.c +70 -0
  25. data/ext/nokogiri/xml_attribute_decl.h +9 -0
  26. data/ext/nokogiri/xml_cdata.c +21 -9
  27. data/ext/nokogiri/xml_cdata.h +1 -1
  28. data/ext/nokogiri/xml_comment.c +18 -6
  29. data/ext/nokogiri/xml_comment.h +1 -1
  30. data/ext/nokogiri/xml_document.c +247 -68
  31. data/ext/nokogiri/xml_document.h +5 -3
  32. data/ext/nokogiri/xml_document_fragment.c +15 -7
  33. data/ext/nokogiri/xml_document_fragment.h +1 -1
  34. data/ext/nokogiri/xml_dtd.c +110 -10
  35. data/ext/nokogiri/xml_dtd.h +3 -1
  36. data/ext/nokogiri/xml_element_content.c +123 -0
  37. data/ext/nokogiri/xml_element_content.h +10 -0
  38. data/ext/nokogiri/xml_element_decl.c +69 -0
  39. data/ext/nokogiri/xml_element_decl.h +9 -0
  40. data/ext/nokogiri/xml_encoding_handler.c +79 -0
  41. data/ext/nokogiri/xml_encoding_handler.h +8 -0
  42. data/ext/nokogiri/xml_entity_decl.c +110 -0
  43. data/ext/nokogiri/xml_entity_decl.h +10 -0
  44. data/ext/nokogiri/xml_entity_reference.c +16 -5
  45. data/ext/nokogiri/xml_entity_reference.h +1 -1
  46. data/ext/nokogiri/xml_io.c +40 -8
  47. data/ext/nokogiri/xml_io.h +2 -1
  48. data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
  49. data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
  50. data/ext/nokogiri/xml_namespace.c +84 -0
  51. data/ext/nokogiri/xml_namespace.h +13 -0
  52. data/ext/nokogiri/xml_node.c +782 -225
  53. data/ext/nokogiri/xml_node.h +2 -4
  54. data/ext/nokogiri/xml_node_set.c +253 -34
  55. data/ext/nokogiri/xml_node_set.h +2 -2
  56. data/ext/nokogiri/xml_processing_instruction.c +17 -5
  57. data/ext/nokogiri/xml_processing_instruction.h +1 -1
  58. data/ext/nokogiri/xml_reader.c +277 -85
  59. data/ext/nokogiri/xml_reader.h +1 -1
  60. data/ext/nokogiri/xml_relax_ng.c +168 -0
  61. data/ext/nokogiri/xml_relax_ng.h +9 -0
  62. data/ext/nokogiri/xml_sax_parser.c +183 -111
  63. data/ext/nokogiri/xml_sax_parser.h +30 -1
  64. data/ext/nokogiri/xml_sax_parser_context.c +199 -0
  65. data/ext/nokogiri/xml_sax_parser_context.h +10 -0
  66. data/ext/nokogiri/xml_sax_push_parser.c +42 -12
  67. data/ext/nokogiri/xml_sax_push_parser.h +1 -1
  68. data/ext/nokogiri/xml_schema.c +205 -0
  69. data/ext/nokogiri/xml_schema.h +9 -0
  70. data/ext/nokogiri/xml_syntax_error.c +28 -173
  71. data/ext/nokogiri/xml_syntax_error.h +2 -1
  72. data/ext/nokogiri/xml_text.c +16 -6
  73. data/ext/nokogiri/xml_text.h +1 -1
  74. data/ext/nokogiri/xml_xpath_context.c +104 -47
  75. data/ext/nokogiri/xml_xpath_context.h +1 -1
  76. data/ext/nokogiri/xslt_stylesheet.c +161 -19
  77. data/ext/nokogiri/xslt_stylesheet.h +1 -1
  78. data/lib/nokogiri.rb +47 -8
  79. data/lib/nokogiri/1.8/nokogiri.so +0 -0
  80. data/lib/nokogiri/1.9/nokogiri.so +0 -0
  81. data/lib/nokogiri/css.rb +6 -3
  82. data/lib/nokogiri/css/node.rb +14 -12
  83. data/lib/nokogiri/css/parser.rb +665 -62
  84. data/lib/nokogiri/css/parser.y +20 -10
  85. data/lib/nokogiri/css/parser_extras.rb +91 -0
  86. data/lib/nokogiri/css/tokenizer.rb +148 -5
  87. data/lib/nokogiri/css/tokenizer.rex +10 -9
  88. data/lib/nokogiri/css/xpath_visitor.rb +47 -44
  89. data/lib/nokogiri/decorators/slop.rb +8 -4
  90. data/lib/nokogiri/ffi/encoding_handler.rb +42 -0
  91. data/lib/nokogiri/ffi/html/document.rb +28 -0
  92. data/lib/nokogiri/ffi/html/element_description.rb +81 -0
  93. data/lib/nokogiri/ffi/html/entity_lookup.rb +16 -0
  94. data/lib/nokogiri/ffi/html/sax/parser_context.rb +38 -0
  95. data/lib/nokogiri/ffi/io_callbacks.rb +42 -0
  96. data/lib/nokogiri/ffi/libxml.rb +420 -0
  97. data/lib/nokogiri/ffi/structs/common_node.rb +38 -0
  98. data/lib/nokogiri/ffi/structs/html_elem_desc.rb +24 -0
  99. data/lib/nokogiri/ffi/structs/html_entity_desc.rb +13 -0
  100. data/lib/nokogiri/ffi/structs/xml_alloc.rb +16 -0
  101. data/lib/nokogiri/ffi/structs/xml_attr.rb +20 -0
  102. data/lib/nokogiri/ffi/structs/xml_attribute.rb +27 -0
  103. data/lib/nokogiri/ffi/structs/xml_buffer.rb +16 -0
  104. data/lib/nokogiri/ffi/structs/xml_char_encoding_handler.rb +11 -0
  105. data/lib/nokogiri/ffi/structs/xml_document.rb +117 -0
  106. data/lib/nokogiri/ffi/structs/xml_dtd.rb +28 -0
  107. data/lib/nokogiri/ffi/structs/xml_element.rb +26 -0
  108. data/lib/nokogiri/ffi/structs/xml_element_content.rb +17 -0
  109. data/lib/nokogiri/ffi/structs/xml_entity.rb +32 -0
  110. data/lib/nokogiri/ffi/structs/xml_enumeration.rb +12 -0
  111. data/lib/nokogiri/ffi/structs/xml_node.rb +28 -0
  112. data/lib/nokogiri/ffi/structs/xml_node_set.rb +53 -0
  113. data/lib/nokogiri/ffi/structs/xml_notation.rb +11 -0
  114. data/lib/nokogiri/ffi/structs/xml_ns.rb +15 -0
  115. data/lib/nokogiri/ffi/structs/xml_parser_context.rb +20 -0
  116. data/lib/nokogiri/ffi/structs/xml_parser_input.rb +19 -0
  117. data/lib/nokogiri/ffi/structs/xml_relax_ng.rb +14 -0
  118. data/lib/nokogiri/ffi/structs/xml_sax_handler.rb +51 -0
  119. data/lib/nokogiri/ffi/structs/xml_sax_push_parser_context.rb +124 -0
  120. data/lib/nokogiri/ffi/structs/xml_schema.rb +13 -0
  121. data/lib/nokogiri/ffi/structs/xml_syntax_error.rb +31 -0
  122. data/lib/nokogiri/ffi/structs/xml_text_reader.rb +12 -0
  123. data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +38 -0
  124. data/lib/nokogiri/ffi/structs/xml_xpath_object.rb +35 -0
  125. data/lib/nokogiri/ffi/structs/xml_xpath_parser_context.rb +20 -0
  126. data/lib/nokogiri/ffi/structs/xslt_stylesheet.rb +13 -0
  127. data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
  128. data/lib/nokogiri/ffi/xml/attr.rb +41 -0
  129. data/lib/nokogiri/ffi/xml/attribute_decl.rb +27 -0
  130. data/lib/nokogiri/ffi/xml/cdata.rb +19 -0
  131. data/lib/nokogiri/ffi/xml/comment.rb +18 -0
  132. data/lib/nokogiri/ffi/xml/document.rb +174 -0
  133. data/lib/nokogiri/ffi/xml/document_fragment.rb +21 -0
  134. data/lib/nokogiri/ffi/xml/dtd.rb +67 -0
  135. data/lib/nokogiri/ffi/xml/element_content.rb +43 -0
  136. data/lib/nokogiri/ffi/xml/element_decl.rb +19 -0
  137. data/lib/nokogiri/ffi/xml/entity_decl.rb +36 -0
  138. data/lib/nokogiri/ffi/xml/entity_reference.rb +19 -0
  139. data/lib/nokogiri/ffi/xml/namespace.rb +44 -0
  140. data/lib/nokogiri/ffi/xml/node.rb +559 -0
  141. data/lib/nokogiri/ffi/xml/node_set.rb +150 -0
  142. data/lib/nokogiri/ffi/xml/processing_instruction.rb +20 -0
  143. data/lib/nokogiri/ffi/xml/reader.rb +236 -0
  144. data/lib/nokogiri/ffi/xml/relax_ng.rb +85 -0
  145. data/lib/nokogiri/ffi/xml/sax/parser.rb +143 -0
  146. data/lib/nokogiri/ffi/xml/sax/parser_context.rb +79 -0
  147. data/lib/nokogiri/ffi/xml/sax/push_parser.rb +51 -0
  148. data/lib/nokogiri/ffi/xml/schema.rb +109 -0
  149. data/lib/nokogiri/ffi/xml/syntax_error.rb +98 -0
  150. data/lib/nokogiri/ffi/xml/text.rb +18 -0
  151. data/lib/nokogiri/ffi/xml/xpath.rb +9 -0
  152. data/lib/nokogiri/ffi/xml/xpath_context.rb +153 -0
  153. data/lib/nokogiri/ffi/xslt/stylesheet.rb +77 -0
  154. data/lib/nokogiri/html.rb +13 -47
  155. data/lib/nokogiri/html/builder.rb +27 -1
  156. data/lib/nokogiri/html/document.rb +201 -7
  157. data/lib/nokogiri/html/document_fragment.rb +41 -0
  158. data/lib/nokogiri/html/element_description.rb +23 -0
  159. data/lib/nokogiri/html/entity_lookup.rb +2 -0
  160. data/lib/nokogiri/html/sax/parser.rb +34 -3
  161. data/lib/nokogiri/html/sax/parser_context.rb +16 -0
  162. data/lib/nokogiri/nokogiri.rb +1 -0
  163. data/lib/nokogiri/version.rb +40 -1
  164. data/lib/nokogiri/version_warning.rb +14 -0
  165. data/lib/nokogiri/xml.rb +32 -53
  166. data/lib/nokogiri/xml/attr.rb +5 -0
  167. data/lib/nokogiri/xml/attribute_decl.rb +18 -0
  168. data/lib/nokogiri/xml/builder.rb +349 -29
  169. data/lib/nokogiri/xml/cdata.rb +3 -1
  170. data/lib/nokogiri/xml/character_data.rb +7 -0
  171. data/lib/nokogiri/xml/document.rb +166 -14
  172. data/lib/nokogiri/xml/document_fragment.rb +76 -1
  173. data/lib/nokogiri/xml/dtd.rb +16 -3
  174. data/lib/nokogiri/xml/element_content.rb +36 -0
  175. data/lib/nokogiri/xml/element_decl.rb +13 -0
  176. data/lib/nokogiri/xml/entity_decl.rb +19 -0
  177. data/lib/nokogiri/xml/namespace.rb +13 -0
  178. data/lib/nokogiri/xml/node.rb +561 -166
  179. data/lib/nokogiri/xml/node/save_options.rb +22 -2
  180. data/lib/nokogiri/xml/node_set.rb +202 -40
  181. data/lib/nokogiri/xml/parse_options.rb +93 -0
  182. data/lib/nokogiri/xml/pp.rb +2 -0
  183. data/lib/nokogiri/xml/pp/character_data.rb +18 -0
  184. data/lib/nokogiri/xml/pp/node.rb +56 -0
  185. data/lib/nokogiri/xml/processing_instruction.rb +2 -0
  186. data/lib/nokogiri/xml/reader.rb +93 -8
  187. data/lib/nokogiri/xml/relax_ng.rb +32 -0
  188. data/lib/nokogiri/xml/sax.rb +1 -7
  189. data/lib/nokogiri/xml/sax/document.rb +107 -2
  190. data/lib/nokogiri/xml/sax/parser.rb +57 -7
  191. data/lib/nokogiri/xml/sax/parser_context.rb +16 -0
  192. data/lib/nokogiri/xml/sax/push_parser.rb +13 -1
  193. data/lib/nokogiri/xml/schema.rb +63 -0
  194. data/lib/nokogiri/xml/syntax_error.rb +25 -1
  195. data/lib/nokogiri/xml/text.rb +4 -1
  196. data/lib/nokogiri/xml/xpath.rb +1 -1
  197. data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
  198. data/lib/nokogiri/xml/xpath_context.rb +2 -0
  199. data/lib/nokogiri/xslt.rb +26 -2
  200. data/lib/nokogiri/xslt/stylesheet.rb +19 -0
  201. data/lib/xsd/xmlparser/nokogiri.rb +45 -9
  202. data/tasks/cross_compile.rb +173 -0
  203. data/tasks/test.rb +25 -69
  204. data/test/css/test_nthiness.rb +3 -4
  205. data/test/css/test_parser.rb +75 -20
  206. data/test/css/test_tokenizer.rb +23 -1
  207. data/test/css/test_xpath_visitor.rb +10 -1
  208. data/test/decorators/test_slop.rb +16 -0
  209. data/test/ffi/test_document.rb +35 -0
  210. data/test/files/2ch.html +108 -0
  211. data/test/files/address_book.rlx +12 -0
  212. data/test/files/address_book.xml +10 -0
  213. data/test/files/bar/bar.xsd +4 -0
  214. data/test/files/encoding.html +82 -0
  215. data/test/files/encoding.xhtml +84 -0
  216. data/test/files/foo/foo.xsd +4 -0
  217. data/test/files/po.xml +32 -0
  218. data/test/files/po.xsd +66 -0
  219. data/test/files/shift_jis.html +10 -0
  220. data/test/files/shift_jis.xml +5 -0
  221. data/test/files/snuggles.xml +3 -0
  222. data/test/files/staff.dtd +10 -0
  223. data/test/files/valid_bar.xml +2 -0
  224. data/test/helper.rb +101 -23
  225. data/test/html/sax/test_parser.rb +81 -2
  226. data/test/html/sax/test_parser_context.rb +48 -0
  227. data/test/html/test_builder.rb +39 -8
  228. data/test/html/test_document.rb +186 -23
  229. data/test/html/test_document_encoding.rb +78 -1
  230. data/test/html/test_document_fragment.rb +253 -0
  231. data/test/html/test_element_description.rb +98 -0
  232. data/test/html/test_named_characters.rb +1 -1
  233. data/test/html/test_node.rb +124 -36
  234. data/test/html/test_node_encoding.rb +27 -0
  235. data/test/test_convert_xpath.rb +1 -52
  236. data/test/test_css_cache.rb +2 -13
  237. data/test/test_encoding_handler.rb +46 -0
  238. data/test/test_memory_leak.rb +88 -19
  239. data/test/test_nokogiri.rb +38 -5
  240. data/test/test_reader.rb +188 -6
  241. data/test/test_soap4r_sax.rb +52 -0
  242. data/test/test_xslt_transforms.rb +183 -83
  243. data/test/xml/node/test_save_options.rb +1 -1
  244. data/test/xml/node/test_subclass.rb +44 -0
  245. data/test/xml/sax/test_parser.rb +175 -4
  246. data/test/xml/sax/test_parser_context.rb +113 -0
  247. data/test/xml/sax/test_push_parser.rb +90 -2
  248. data/test/xml/test_attr.rb +35 -1
  249. data/test/xml/test_attribute_decl.rb +82 -0
  250. data/test/xml/test_builder.rb +186 -1
  251. data/test/xml/test_cdata.rb +32 -1
  252. data/test/xml/test_comment.rb +13 -1
  253. data/test/xml/test_document.rb +415 -43
  254. data/test/xml/test_document_encoding.rb +1 -1
  255. data/test/xml/test_document_fragment.rb +173 -5
  256. data/test/xml/test_dtd.rb +61 -6
  257. data/test/xml/test_dtd_encoding.rb +3 -1
  258. data/test/xml/test_element_content.rb +56 -0
  259. data/test/xml/test_element_decl.rb +73 -0
  260. data/test/xml/test_entity_decl.rb +120 -0
  261. data/test/xml/test_entity_reference.rb +5 -1
  262. data/test/xml/test_namespace.rb +68 -0
  263. data/test/xml/test_node.rb +546 -201
  264. data/test/xml/test_node_attributes.rb +34 -0
  265. data/test/xml/test_node_encoding.rb +33 -3
  266. data/test/xml/test_node_reparenting.rb +321 -0
  267. data/test/xml/test_node_set.rb +538 -2
  268. data/test/xml/test_parse_options.rb +52 -0
  269. data/test/xml/test_processing_instruction.rb +6 -1
  270. data/test/xml/test_reader_encoding.rb +1 -1
  271. data/test/xml/test_relax_ng.rb +60 -0
  272. data/test/xml/test_schema.rb +94 -0
  273. data/test/xml/test_syntax_error.rb +12 -0
  274. data/test/xml/test_text.rb +35 -1
  275. data/test/xml/test_unparented_node.rb +5 -5
  276. data/test/xml/test_xpath.rb +142 -11
  277. data/test/xslt/test_custom_functions.rb +94 -0
  278. metadata +328 -92
  279. data/ext/nokogiri/html_sax_parser.c +0 -57
  280. data/ext/nokogiri/html_sax_parser.h +0 -11
  281. data/ext/nokogiri/iconv.dll +0 -0
  282. data/ext/nokogiri/libexslt.dll +0 -0
  283. data/ext/nokogiri/libxml2.dll +0 -0
  284. data/ext/nokogiri/libxslt.dll +0 -0
  285. data/ext/nokogiri/native.so +0 -0
  286. data/ext/nokogiri/xml_xpath.c +0 -53
  287. data/ext/nokogiri/xml_xpath.h +0 -11
  288. data/ext/nokogiri/zlib1.dll +0 -0
  289. data/lib/action-nokogiri.rb +0 -30
  290. data/lib/nokogiri/css/generated_parser.rb +0 -713
  291. data/lib/nokogiri/css/generated_tokenizer.rb +0 -144
  292. data/lib/nokogiri/decorators.rb +0 -2
  293. data/lib/nokogiri/decorators/hpricot.rb +0 -3
  294. data/lib/nokogiri/decorators/hpricot/node.rb +0 -56
  295. data/lib/nokogiri/decorators/hpricot/node_set.rb +0 -54
  296. data/lib/nokogiri/decorators/hpricot/xpath_visitor.rb +0 -28
  297. data/lib/nokogiri/hpricot.rb +0 -51
  298. data/lib/nokogiri/xml/comment.rb +0 -6
  299. data/lib/nokogiri/xml/element.rb +0 -6
  300. data/lib/nokogiri/xml/entity_declaration.rb +0 -9
  301. data/lib/nokogiri/xml/fragment_handler.rb +0 -34
  302. data/test/hpricot/files/basic.xhtml +0 -17
  303. data/test/hpricot/files/boingboing.html +0 -2266
  304. data/test/hpricot/files/cy0.html +0 -3653
  305. data/test/hpricot/files/immob.html +0 -400
  306. data/test/hpricot/files/pace_application.html +0 -1320
  307. data/test/hpricot/files/tenderlove.html +0 -16
  308. data/test/hpricot/files/uswebgen.html +0 -220
  309. data/test/hpricot/files/utf8.html +0 -1054
  310. data/test/hpricot/files/week9.html +0 -1723
  311. data/test/hpricot/files/why.xml +0 -19
  312. data/test/hpricot/load_files.rb +0 -11
  313. data/test/hpricot/test_alter.rb +0 -68
  314. data/test/hpricot/test_builder.rb +0 -20
  315. data/test/hpricot/test_parser.rb +0 -426
  316. data/test/hpricot/test_paths.rb +0 -15
  317. data/test/hpricot/test_preserved.rb +0 -77
  318. data/test/hpricot/test_xml.rb +0 -30
  319. data/test/test_gc.rb +0 -15
@@ -1,19 +0,0 @@
1
- <?xml version='1.0'?><rss xmlns:admin='http://webns.net/mvcb/' version='2.0' xmlns:sy='http://purl.org/rss/1.0/modules/syndication/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
2
- <channel>
3
- <title>why the lucky stiff</title>
4
- <link>http://whytheluckystiff.net</link>
5
- <description>hex-editing reality to give us infinite grenades!!</description>
6
- <dc:language>en-us</dc:language>
7
- <dc:creator/>
8
- <dc:date>2007-01-16T22:39:04+00:00</dc:date>
9
- <admin:generatorAgent rdf:resource='http://hobix.com/?v=0.4'/>
10
- <sy:updatePeriod>hourly</sy:updatePeriod>
11
- <sy:updateFrequency>1</sy:updateFrequency>
12
- <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
13
- <item><title>1.3</title><link>http://whytheluckystiff.net/quatrains/1.3.html</link><guid isPermaLink='false'>quatrains/1.3@http://whytheluckystiff.net</guid><dc:subject>quatrains</dc:subject><dc:subject>quatrains</dc:subject><dc:creator>why the lucky stiff</dc:creator><dc:date>2007-01-14T08:47:05+00:00</dc:date><description>&lt;blockquote&gt;
14
- &lt;p&gt;That cadillac of yours and that driver of yours!&lt;br /&gt;You and your teacups rattling away in the back seat!&lt;br /&gt;You always took the mike, oh, and all those cowboys you shot!&lt;br /&gt;I held your hand! And I&amp;#8217;ll shoot a cowboy one day!&lt;/p&gt;
15
- &lt;/blockquote&gt;
16
- &lt;blockquote&gt;
17
- &lt;p&gt;You said, &amp;#8220;Let&amp;#8217;s run into the woods like kids!&amp;#8221; &lt;br /&gt;You said, &amp;#8220;Let&amp;#8217;s rub our hands together super-hot!&amp;#8221; &lt;br /&gt;And we scalded the trees and left octagons, I think that was you and&lt;br /&gt;You threw parties on the roof!&lt;/p&gt;
18
- &lt;/blockquote&gt;</description></item></channel>
19
- </rss>
@@ -1,11 +0,0 @@
1
- module TestFiles
2
- Dir.chdir(File.dirname(__FILE__)) do
3
- Dir['files/*.{html,xhtml,xml}'].each do |fname|
4
- if RUBY_VERSION >= '1.9'
5
- const_set fname[%r!/(\w+)\.\w+$!, 1].upcase, File.open(fname, 'r:ascii-8bit') { |f| f.read }
6
- else
7
- const_set fname[%r!/(\w+)\.\w+$!, 1].upcase, File.read(fname)
8
- end
9
- end
10
- end
11
- end
@@ -1,68 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
2
- require File.join(File.dirname(__FILE__),"load_files")
3
-
4
- class TestAlter < Nokogiri::TestCase
5
- include Nokogiri
6
-
7
- def setup
8
- super
9
- @basic = Hpricot.parse(TestFiles::BASIC)
10
- end
11
-
12
- def test_before
13
- test0 = "<link rel='stylesheet' href='test0.css' />"
14
- @basic.at("link").before(test0)
15
- assert_equal 'test0.css', @basic.at("link").attributes['href'].to_s
16
- end
17
-
18
- def test_after
19
- test_inf = "<link rel='stylesheet' href='test_inf.css' />"
20
- @basic.search("link")[-1].after(test_inf)
21
- assert_equal 'test_inf.css', @basic.search("link")[-1]['href']
22
- end
23
-
24
- def test_wrap
25
- ohmy = (@basic/"p.ohmy").wrap("<div id='wrapper'></div>")
26
- assert_equal 'wrapper', ohmy[0].parent['id']
27
- assert_equal 'ohmy', Nokogiri.Hpricot(@basic.to_html).at("#wrapper").children[0]['class']
28
- end
29
-
30
- def test_add_class
31
- first_p = (@basic/"p:first").add_class("testing123")
32
- assert first_p[0].get_attribute("class").split(" ").include?("testing123")
33
- assert((Nokogiri.Hpricot(@basic.to_html)/"p:first")[0]["class"].split(" ").include?("testing123"))
34
- ####
35
- # Modified. We do not support OB1 bug.
36
- assert !(Nokogiri.Hpricot(@basic.to_html)/"p:gt(1)")[0]["class"].split(" ").include?("testing123")
37
- end
38
-
39
- def test_change_attributes
40
- all_ps = (@basic/"p").attr("title", "Some Title")
41
- all_as = (@basic/"a").attr("href", "http://my_new_href.com")
42
- all_lb = (@basic/"link").attr("href") { |e| e.name }
43
- GC.start # try to shake out GC bugs with xpath and node sets.
44
- assert_changed(@basic, "p", all_ps) {|p| p.attributes["title"].to_s == "Some Title"}
45
- assert_changed(@basic, "a", all_as) {|a| a.attributes["href"].to_s == "http://my_new_href.com"}
46
- assert_changed(@basic, "link", all_lb) {|a| a.attributes["href"].to_s == "link" }
47
- end
48
-
49
- def test_remove_attr
50
- all_rl = (@basic/"link").remove_attr("href")
51
- assert_changed(@basic, "link", all_rl) { |link| link['href'].nil? }
52
- end
53
-
54
- def test_remove_class
55
- all_c1 = (@basic/"p[@class*='last']").remove_class("last")
56
- assert_changed(@basic, "p[@class*='last']", all_c1) { |p| p['class'] == 'final' }
57
- end
58
-
59
- def test_remove_all_classes
60
- all_c2 = (@basic/"p[@class]").remove_class
61
- assert_changed(@basic, "p[@class]", all_c2) { |p| p['class'].nil? }
62
- end
63
-
64
- def assert_changed original, selector, set, &block
65
- assert set.all?(&block)
66
- assert Nokogiri.Hpricot(original.to_html).search(selector).all?(&block)
67
- end
68
- end
@@ -1,20 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
2
-
3
- class TestBuilder < Nokogiri::TestCase
4
- ####
5
- # Modified
6
- def test_escaping_text
7
- doc = Nokogiri.Hpricot() { b "<a\"b>" }
8
- assert_match "<b>&lt;a\"b&gt;</b>", doc.to_html.chomp
9
- assert_equal %{&lt;a\"b&gt;}, doc.at("text()").to_s
10
- end
11
-
12
- ####
13
- # Modified
14
- def test_no_escaping_text
15
- doc = Nokogiri.Hpricot() { div.test.me! { text "<a\"b>" } }
16
- assert_match %{<div class="test" id="me">&lt;a"b&gt;</div>},
17
- doc.to_html.chomp
18
- assert_equal %{&lt;a\"b&gt;}, doc.at("text()").to_s
19
- end
20
- end
@@ -1,426 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
2
- require File.join(File.dirname(__FILE__),"load_files")
3
-
4
- class TestParser < Nokogiri::TestCase
5
- include Nokogiri
6
-
7
- def test_set_attr
8
- @basic = Hpricot.parse(TestFiles::BASIC)
9
- @basic.search('//p').set('class', 'para')
10
- assert_equal 4, @basic.search('//p').length
11
- assert_equal 4, @basic.search('//p').find_all { |x| x['class'] == 'para' }.length
12
- end
13
-
14
- # Modified. Not supported
15
- ## Test creating a new element
16
- #def test_new_element
17
- # elem = Hpricot::Elem.new(Hpricot::STag.new('form'))
18
- # assert_not_nil(elem)
19
- # assert_not_nil(elem.attributes)
20
- #end
21
-
22
- def test_scan_text
23
- assert_equal 'FOO', Hpricot.make("FOO").first.content
24
- end
25
-
26
- def test_filter_by_attr
27
- @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
28
-
29
- # this link is escaped in the doc
30
- link = 'http://www.youtube.com/watch?v=TvSNXyNw26g&search=chris%20ware'
31
- assert_equal link, @boingboing.at("a[@href='#{link}']")['href']
32
- end
33
-
34
- def test_filter_contains
35
- @basic = Hpricot.parse(TestFiles::BASIC)
36
- assert_equal '<title>Sample XHTML</title>', @basic.search("title:contains('Sample')").to_s.chomp
37
- end
38
-
39
- def test_get_element_by_id
40
- @basic = Hpricot.parse(TestFiles::BASIC)
41
- assert_equal 'link1', @basic.get_element_by_id('link1')['id']
42
- assert_equal 'link1', @basic.get_element_by_id('body1').get_element_by_id('link1').get_attribute('id')
43
- end
44
-
45
- def test_get_element_by_tag_name
46
- @basic = Hpricot.parse(TestFiles::BASIC)
47
- assert_equal 'link1', @basic.get_elements_by_tag_name('a')[0].get_attribute('id')
48
- assert_equal 'link1', @basic.get_elements_by_tag_name('body')[0].get_element_by_id('link1').get_attribute('id')
49
- end
50
-
51
- def test_output_basic
52
- @basic = Hpricot.parse(TestFiles::BASIC)
53
- @basic2 = Hpricot.parse(@basic.inner_html)
54
- scan_basic @basic2
55
- end
56
-
57
- def test_scan_basic
58
- @basic = Hpricot.parse(TestFiles::BASIC)
59
- scan_basic @basic
60
- end
61
-
62
- def scan_basic doc
63
- ####
64
- # Modified: asserting kind is not duck typey
65
- #assert_kind_of Hpricot::XMLDecl, doc.children.first
66
- assert_not_equal doc.children.first.to_s, doc.children[1].to_s
67
- assert_equal 'link1', doc.at('#link1')['id']
68
- assert_equal 'link1', doc.at("p a")['id']
69
- assert_equal 'link1', (doc/:p/:a).first['id']
70
- assert_equal 'link1', doc.search('p').at('a').get_attribute('id')
71
-
72
- assert_equal 'link2', (doc/'p').filter('.ohmy').search('a').first.get_attribute('id')
73
- assert_equal((doc/'p')[2], (doc/'p').filter('[text()="The third paragraph"]')[0])
74
- assert_equal((doc/'p')[3], (doc/'p').filter('b')[0])
75
- assert_equal((doc/'p')[1], (doc/'p').filter('a[@id="link2"]')[0])
76
- assert_equal((doc/'p')[3], (doc/'p').filter('.last')[0])
77
- assert_equal 4, (doc/'p').filter('*').length
78
- assert_equal 3, (doc/'p').filter('* *').length
79
- eles = (doc/'p').filter('.ohmy')
80
- assert_equal 1, eles.length
81
- assert_equal 'ohmy', eles.first.get_attribute('class')
82
- assert_equal 3, (doc/'p:not(.ohmy)').length
83
-
84
- assert_equal 3, (doc/'p').not('.ohmy').length
85
- assert_equal 3, (doc/'p').not(eles.first).length
86
- assert_equal 2, (doc/'p').filter('[@class]').length
87
- assert_equal 'last final', (doc/'p[@class~="final"]').first.get_attribute('class')
88
- assert_equal 1, (doc/'p').filter('[@class~="final"]').length
89
- assert_equal 2, (doc/'p > a').length
90
- assert_equal 1, (doc/'p.ohmy > a').length
91
- assert_equal 2, (doc/'p / a').length
92
- assert_equal 2, (doc/'link ~ link').length
93
- assert_equal 3, (doc/'title ~ link').length
94
- assert_equal 5, (doc/"//p/text()").length
95
- assert_equal 6, (doc/"//p[a]//text()").length
96
- assert_equal 2, (doc/"//p/a/text()").length
97
- end
98
-
99
- def test_positional
100
- h = Nokogiri.Hpricot( "<div><br/><p>one</p><p>two</p></div>" )
101
- assert_equal "<p>one</p>", h.search("div/p:eq(1)").to_s.chomp # MODIFIED: eq(0) -> eq(1), and removed initial '//'
102
- assert_equal "<p>one</p>", h.search("div/p:first").to_s.chomp # MODIFIED: removed initial '//'
103
- assert_equal "<p>one</p>", h.search("div/p:first()").to_s.chomp # MODIFIED: removed initial '//'
104
- end
105
-
106
- def test_pace
107
- doc = Nokogiri.Hpricot(TestFiles::PACE_APPLICATION)
108
- assert_equal 'get', doc.at('form[@name=frmSect11]')['method']
109
- # assert_equal '2', doc.at('#hdnSpouse')['value']
110
- end
111
-
112
- def test_scan_boingboing
113
- @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
114
- assert_equal 60, (@boingboing/'p.posted').length
115
- assert_equal 1, @boingboing.search("//a[@name='027906']").length
116
- ### MODIFIED: libxml wraps the contents of <script> in a CDATA tag, so we won't be able to parse comments.
117
- # assert_equal 10, @boingboing.search("script comment()").length
118
- assert_equal 3, @boingboing.search("a[text()*='Boing']").length
119
- assert_equal 1, @boingboing.search("h3[text()='College kids reportedly taking more smart drugs']").length
120
- assert_equal 0, @boingboing.search("h3[text()='College']").length
121
- assert_equal 60, @boingboing.search("h3").length
122
- assert_equal 59, @boingboing.search("h3[text()!='College kids reportedly taking more smart drugs']").length
123
- assert_equal 17, @boingboing.search("h3[text()$='s']").length
124
- ### Modified. Hpricot is wrong
125
- #assert_equal 129, @boingboing.search("p[text()]").length
126
- ## This test seems to change between libxml versions, so I'm commenting
127
- ## it out.
128
- #if Nokogiri::LIBXML_VERSION == '2.6.16'
129
- # assert_equal 111, @boingboing.search("p[text()]").length
130
- #else
131
- # assert_equal 110, @boingboing.search("p[text()]").length
132
- #end
133
- assert_equal 211, @boingboing.search("p").length
134
- end
135
-
136
- def test_reparent
137
- doc = Nokogiri.Hpricot(%{<div id="blurb_1"></div>})
138
- div1 = doc.search('#blurb_1')
139
- div1.before('<div id="blurb_0"></div>')
140
-
141
- div0 = doc.search('#blurb_0')
142
- div0.before('<div id="blurb_a"></div>')
143
-
144
- assert_equal 'div', doc.at('#blurb_1').name
145
- end
146
-
147
- def test_siblings
148
- @basic = Hpricot.parse(TestFiles::BASIC)
149
- t = @basic.at(:title)
150
- e = t.next_sibling
151
- assert_equal 'test1.css', e['href']
152
- assert_equal 'title', e.previous_sibling.name
153
- end
154
-
155
- def test_css_negation
156
- @basic = Hpricot.parse(TestFiles::BASIC)
157
- assert_equal 3, (@basic/'p:not(.final)').length
158
- end
159
-
160
- def test_remove_attribute
161
- @basic = Hpricot.parse(TestFiles::BASIC)
162
- (@basic/:p).each { |ele| ele.remove_attribute('class') }
163
- assert_equal 0, (@basic/'p[@class]').length
164
- end
165
-
166
- ##
167
- # Modified: hpricot is giving incorrect counts. Libxml gets it right.
168
- def test_abs_xpath
169
- @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
170
- assert_equal 60, @boingboing.search("/html/body//p[@class='posted']").length
171
- assert_equal 60, @boingboing.search("/*/body//p[@class='posted']").length
172
- assert_equal 18, @boingboing.search("//script").length
173
- divs = @boingboing.search("//script/../div")
174
- assert_equal 2, divs.length # hpricot says this is 1, but that's wrong.
175
- imgs = @boingboing.search('//div/p/a/img')
176
- assert_equal 12, imgs.length # hpricot says this is 15, but that's wrong.
177
- assert_equal 16, @boingboing.search('//div').search('p/a/img').length
178
- assert imgs.all? { |x| x.name == 'img' }
179
- end
180
-
181
- def test_predicates
182
- @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
183
- assert_equal 2, @boingboing.search('//link[@rel="alternate"]').length
184
- p_imgs = @boingboing.search('//div/p[/a/img]')
185
- #assert_equal 15, p_imgs.length
186
- assert p_imgs.all? { |x| x.name == 'p' }
187
- p_imgs = @boingboing.search('//div/p[a/img]')
188
- assert_equal 12, p_imgs.length
189
- assert p_imgs.all? { |x| x.name == 'p' }
190
- assert_equal 1, @boingboing.search('//input[@checked]').length
191
- end
192
-
193
- def test_tag_case
194
- @tenderlove = Hpricot.parse(TestFiles::TENDERLOVE)
195
- assert_equal 2, @tenderlove.search('//a').length
196
- assert_equal 3, @tenderlove.search('//area').length
197
- assert_equal 2, @tenderlove.search('//meta').length
198
- end
199
-
200
- def test_alt_predicates
201
- @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
202
- assert_equal 2, @boingboing.search('table/tr:last').length # MODIFIED to not have '//' prefix
203
-
204
- @basic = Hpricot.parse(TestFiles::BASIC)
205
- ##
206
- # MODIFIED:
207
- # hpricot has an off-by-one bug eith eq-and-friends.
208
- assert_equal "<p>The third paragraph</p>",
209
- @basic.search('p:eq(3)').to_html.chomp # under Hpricot this was eq(2)
210
- ##
211
- # MODIFIED: to be blank-agnostic, because Nokogiri's to_html is slightly different compared to Hpricot.
212
- assert_equal '<p class="last final"><b>THE FINAL PARAGRAPH</b></p>',
213
- @basic.search('p:last').to_html.gsub(/\s+/,' ').gsub(/>\s*</, '><')
214
- assert_equal 'last final', @basic.search('p:last-of-type').first.get_attribute('class') # MODIFIED to not have '//' prefix
215
- end
216
-
217
- def test_insert_after # ticket #63
218
- doc = Nokogiri.Hpricot('<html><body><div id="a-div"></div></body></html>')
219
- (doc/'div').each do |element|
220
- element.after('<p>Paragraph 1</p><p>Paragraph 2</p>')
221
- end
222
- assert_match '<div id="a-div"></div><p>Paragraph 1</p><p>Paragraph 2</p>',
223
- doc.to_html.gsub(/\n/, '').gsub(/>\s*</, '><')
224
- end
225
-
226
- def test_insert_before # ticket #61
227
- doc = Nokogiri.Hpricot('<html><body><div id="a-div"></div></body></html>')
228
- (doc/'div').each do |element|
229
- element.before('<p>Paragraph 1</p><p>Paragraph 2</p>')
230
- end
231
- assert_match '<p>Paragraph 1</p><p>Paragraph 2</p><div id="a-div"></div>',
232
- doc.to_html.gsub(/\n/, '').gsub(/>\s*</, '><')
233
- end
234
-
235
- def test_many_paths
236
- @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
237
- assert_equal 62, @boingboing.search('p.posted, link[@rel="alternate"]').length
238
- ###
239
- # Modified. I don't want to support this syntax. Just use a comma.
240
- #assert_equal 20, @boingboing.search('//div/p[a/img]|//link[@rel="alternate"]').length
241
- end
242
-
243
- ####
244
- # Modified. Epic Fail. We're on the duck type train folks.
245
- #def test_stacked_search
246
- # @boingboing = Hpricot.parse(TestFiles::BOINGBOING)
247
- # assert_kind_of Hpricot::Elements, @boingboing.search('//div/p').search('a img')
248
- #end
249
-
250
- def test_class_search
251
- # test case sent by Chih-Chao Lam
252
- # Modified. libxml corrects this differently than hpricot
253
- doc = Nokogiri::Hpricot.HTML("<div class=xyz '>abc</div>")
254
- assert_equal 1, doc.search(".xyz").length
255
-
256
- doc = Nokogiri::Hpricot.HTML("<div class=xyz>abc</div><div class=abc>xyz</div>")
257
- assert_equal 1, doc.search(".xyz").length
258
- assert_equal 4, doc.search("*").length
259
- end
260
-
261
- def test_kleene_star
262
- # bug noticed by raja bhatia
263
- doc = Nokogiri::Hpricot.HTML("<span class='small'>1</span><div class='large'>2</div><div class='small'>3</div><span class='blue large'>4</span>")
264
- assert_equal 2, doc.search("*[@class*='small']").length
265
- assert_equal 2, doc.search("*.small").length
266
- assert_equal 2, doc.search(".small").length
267
- assert_equal 2, doc.search(".large").length
268
- end
269
-
270
- def test_empty_comment
271
- doc = Nokogiri::Hpricot.HTML("<p><!----></p>")
272
- doc = doc.search('//body').first
273
- assert doc.children[0].children[0].comment?
274
-
275
- doc = Nokogiri::Hpricot.HTML("<p><!-- --></p>")
276
- doc = doc.search('//body').first
277
- assert doc.children[0].children[0].comment?
278
- end
279
-
280
- def test_body_newlines
281
- @immob = Hpricot.parse(TestFiles::IMMOB)
282
- body = @immob.at(:body)
283
- {'background' => '', 'bgcolor' => '#ffffff', 'text' => '#000000', 'marginheight' => '10',
284
- 'marginwidth' => '10', 'leftmargin' => '10', 'topmargin' => '10', 'link' => '#000066',
285
- 'alink' => '#ff6600', 'hlink' => "#ff6600", 'vlink' => "#000000"}.each do |k, v|
286
- assert_equal v, body[k]
287
- end
288
- end
289
-
290
- def test_nested_twins
291
- @doc = Nokogiri.Hpricot("<div>Hi<div>there</div></div>")
292
- assert_equal 1, (@doc/"div div").length
293
- end
294
-
295
- def test_wildcard
296
- @basic = Hpricot.parse(TestFiles::BASIC)
297
- assert_equal 3, (@basic/"*[@id]").length
298
- assert_equal 3, (@basic/"//*[@id]").length
299
- end
300
-
301
- def test_javascripts
302
- @immob = Hpricot.parse(TestFiles::IMMOB)
303
- assert_equal 3, (@immob/:script)[0].inner_html.scan(/<LINK/).length
304
- end
305
-
306
- ####
307
- # Modified. This test passes with later versions of libxml
308
- def test_nested_scripts
309
- @week9 = Hpricot.parse(TestFiles::WEEK9)
310
- unless Nokogiri::LIBXML_VERSION == '2.6.16'
311
- assert_equal 14, (@week9/"a").find_all { |x| x.inner_html.include? "GameCenter" }.length
312
- end
313
- end
314
-
315
- def test_uswebgen
316
- @uswebgen = Hpricot.parse(TestFiles::USWEBGEN)
317
- # sent by brent beardsley, nokogiri 0.3 had problems with all the links.
318
- assert_equal 67, (@uswebgen/:a).length
319
- end
320
-
321
- def test_mangled_tags
322
- [%{<html><form name='loginForm' method='post' action='/units/a/login/1,13088,779-1,00.html'?URL=></form></html>},
323
- %{<html><form name='loginForm' ?URL= method='post' action='/units/a/login/1,13088,779-1,00.html'></form></html>},
324
- %{<html><form name='loginForm'?URL= ?URL= method='post' action='/units/a/login/1,13088,779-1,00.html'?URL=></form></html>},
325
- %{<html><form name='loginForm' method='post' action='/units/a/login/1,13088,779-1,00.html' ?URL=></form></html>}].
326
- each do |str|
327
- doc = Nokogiri.Hpricot(str)
328
- assert_equal 1, (doc/:form).length
329
- assert_equal '/units/a/login/1,13088,779-1,00.html', doc.at("form")['action']
330
- end
331
- end
332
-
333
- ####
334
- # Modified. Added question. Don't care.
335
- def test_procins
336
- doc = Nokogiri::Hpricot.HTML("<?php print('hello') ?>\n<?xml blah='blah'?>")
337
- assert_equal "php", doc.children[1].target
338
- assert_equal "blah='blah'?", doc.children[2].content #"# quote added so emacs ruby-mode parser doesn't barf
339
- end
340
-
341
- ####
342
- # Altered... libxml does not get a buffer error
343
- def test_buffer_error
344
- assert_nothing_raised {
345
- Nokogiri.Hpricot(%{<p>\n\n<input type="hidden" name="__VIEWSTATE" value="#{(("X" * 2000) + "\n") * 22}" />\n\n</p>})
346
- }
347
- end
348
-
349
- def test_youtube_attr
350
- str = <<-edoc
351
- <html><body>
352
- Lorem ipsum. Jolly roger, ding-dong sing-a-long
353
- <object width="425" height="350">
354
- <param name="movie" value="http://www.youtube.com/v/NbDQ4M_cuwA"></param>
355
- <param name="wmode" value="transparent"></param>
356
- <embed src="http://www.youtube.com/v/NbDQ4M_cuwA"
357
- type="application/x-shockwave-flash" wmode="transparent" width="425" height="350">
358
- </embed>
359
- </object>
360
- Check out my posting, I have bright mice in large clown cars.
361
- <object width="425" height="350">
362
- <param name="movie" value="http://www.youtube.com/v/foobar"></param>
363
- <param name="wmode" value="transparent"></param>
364
- <embed src="http://www.youtube.com/v/foobar"
365
- type="application/x-shockwave-flash" wmode="transparent" width="425" height="350">
366
- </embed>
367
- </object>
368
- </body></html?
369
- edoc
370
- doc = Nokogiri.Hpricot(str)
371
- assert_equal "http://www.youtube.com/v/NbDQ4M_cuwA",
372
- doc.at("//object/param[@value='http://www.youtube.com/v/NbDQ4M_cuwA']")['value']
373
- end
374
-
375
- # ticket #84 by jamezilla
376
- def test_screwed_xmlns
377
- doc = Nokogiri.Hpricot(<<-edoc)
378
- <?xml:namespace prefix = cwi />
379
- <html><body>HAI</body></html>
380
- edoc
381
- assert_equal "HAI", doc.at("body").inner_text
382
- end
383
-
384
- # Reported by Jonathan Nichols on the Hpricot list (24 May 2007)
385
- # MODIFIED: This is an issue with libxml which we cannot deal with....
386
- #def test_self_closed_form
387
- # doc = Nokogiri.Hpricot(<<-edoc)
388
- # <body>
389
- # <form action="/loginRegForm" name="regForm" method="POST" />
390
- # <input type="button">
391
- # </form>
392
- # </body>
393
- # edoc
394
- # assert_equal "button", doc.at("//form/input")['type']
395
- #end
396
-
397
- def test_filters
398
- @basic = Hpricot.parse(TestFiles::BASIC)
399
- ##
400
- # MODIFIED:
401
- # Hpricot considers nodes with text-only (but no child tags) to be empty.
402
- # Nokogiri considers that any content makes a parent.
403
- assert_equal 1, (@basic/"title:parent").size # so this was 0 under Hpricot
404
- assert_equal 4, (@basic/"p:parent").size
405
- assert_equal 0, (@basic/"title:empty").size
406
- assert_equal 3, (@basic/"link:empty").size
407
- end
408
-
409
- def test_keep_cdata
410
- str = %{<script> /*<![CDATA[*/
411
- /*]]>*/ </script>}
412
- # MODIFIED: if you want the cdata, to_xml it
413
- assert_match str, Nokogiri.Hpricot(str).to_xml
414
- end
415
-
416
- def test_namespace
417
- chunk = <<-END
418
- <a xmlns:t="http://www.nexopia.com/dev/template">
419
- <t:sam>hi </t:sam>
420
- </a>
421
- END
422
- doc = Hpricot::XML(chunk)
423
- assert((doc/"//t:sam").size > 0) # at least this should probably work
424
- # assert (doc/"//sam").size > 0 # this would be nice
425
- end
426
- end