rubyjedi-nokogiri_java 1.4.0.20100513161003-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. data/.autotest +26 -0
  2. data/CHANGELOG.ja.rdoc +330 -0
  3. data/CHANGELOG.rdoc +341 -0
  4. data/Manifest.txt +277 -0
  5. data/README.ja.rdoc +105 -0
  6. data/README.rdoc +125 -0
  7. data/Rakefile +307 -0
  8. data/bin/nokogiri +49 -0
  9. data/deps.rip +5 -0
  10. data/ext/nokogiri/extconf.rb +149 -0
  11. data/ext/nokogiri/html_document.c +145 -0
  12. data/ext/nokogiri/html_document.h +10 -0
  13. data/ext/nokogiri/html_element_description.c +272 -0
  14. data/ext/nokogiri/html_element_description.h +10 -0
  15. data/ext/nokogiri/html_entity_lookup.c +32 -0
  16. data/ext/nokogiri/html_entity_lookup.h +8 -0
  17. data/ext/nokogiri/html_sax_parser_context.c +92 -0
  18. data/ext/nokogiri/html_sax_parser_context.h +11 -0
  19. data/ext/nokogiri/nokogiri.c +96 -0
  20. data/ext/nokogiri/nokogiri.h +148 -0
  21. data/ext/nokogiri/xml_attr.c +92 -0
  22. data/ext/nokogiri/xml_attr.h +9 -0
  23. data/ext/nokogiri/xml_attribute_decl.c +67 -0
  24. data/ext/nokogiri/xml_attribute_decl.h +9 -0
  25. data/ext/nokogiri/xml_cdata.c +54 -0
  26. data/ext/nokogiri/xml_cdata.h +9 -0
  27. data/ext/nokogiri/xml_comment.c +52 -0
  28. data/ext/nokogiri/xml_comment.h +9 -0
  29. data/ext/nokogiri/xml_document.c +386 -0
  30. data/ext/nokogiri/xml_document.h +24 -0
  31. data/ext/nokogiri/xml_document_fragment.c +46 -0
  32. data/ext/nokogiri/xml_document_fragment.h +10 -0
  33. data/ext/nokogiri/xml_dtd.c +192 -0
  34. data/ext/nokogiri/xml_dtd.h +10 -0
  35. data/ext/nokogiri/xml_element_content.c +123 -0
  36. data/ext/nokogiri/xml_element_content.h +10 -0
  37. data/ext/nokogiri/xml_element_decl.c +69 -0
  38. data/ext/nokogiri/xml_element_decl.h +9 -0
  39. data/ext/nokogiri/xml_encoding_handler.c +79 -0
  40. data/ext/nokogiri/xml_encoding_handler.h +8 -0
  41. data/ext/nokogiri/xml_entity_decl.c +97 -0
  42. data/ext/nokogiri/xml_entity_decl.h +10 -0
  43. data/ext/nokogiri/xml_entity_reference.c +50 -0
  44. data/ext/nokogiri/xml_entity_reference.h +9 -0
  45. data/ext/nokogiri/xml_io.c +31 -0
  46. data/ext/nokogiri/xml_io.h +11 -0
  47. data/ext/nokogiri/xml_namespace.c +82 -0
  48. data/ext/nokogiri/xml_namespace.h +13 -0
  49. data/ext/nokogiri/xml_node.c +1080 -0
  50. data/ext/nokogiri/xml_node.h +13 -0
  51. data/ext/nokogiri/xml_node_set.c +405 -0
  52. data/ext/nokogiri/xml_node_set.h +9 -0
  53. data/ext/nokogiri/xml_processing_instruction.c +54 -0
  54. data/ext/nokogiri/xml_processing_instruction.h +9 -0
  55. data/ext/nokogiri/xml_reader.c +593 -0
  56. data/ext/nokogiri/xml_reader.h +10 -0
  57. data/ext/nokogiri/xml_relax_ng.c +159 -0
  58. data/ext/nokogiri/xml_relax_ng.h +9 -0
  59. data/ext/nokogiri/xml_sax_parser.c +283 -0
  60. data/ext/nokogiri/xml_sax_parser.h +43 -0
  61. data/ext/nokogiri/xml_sax_parser_context.c +157 -0
  62. data/ext/nokogiri/xml_sax_parser_context.h +10 -0
  63. data/ext/nokogiri/xml_sax_push_parser.c +114 -0
  64. data/ext/nokogiri/xml_sax_push_parser.h +9 -0
  65. data/ext/nokogiri/xml_schema.c +156 -0
  66. data/ext/nokogiri/xml_schema.h +9 -0
  67. data/ext/nokogiri/xml_syntax_error.c +52 -0
  68. data/ext/nokogiri/xml_syntax_error.h +13 -0
  69. data/ext/nokogiri/xml_text.c +48 -0
  70. data/ext/nokogiri/xml_text.h +9 -0
  71. data/ext/nokogiri/xml_xpath.c +53 -0
  72. data/ext/nokogiri/xml_xpath.h +11 -0
  73. data/ext/nokogiri/xml_xpath_context.c +239 -0
  74. data/ext/nokogiri/xml_xpath_context.h +9 -0
  75. data/ext/nokogiri/xslt_stylesheet.c +131 -0
  76. data/ext/nokogiri/xslt_stylesheet.h +9 -0
  77. data/lib/isorelax.jar +0 -0
  78. data/lib/jing.jar +0 -0
  79. data/lib/nekodtd.jar +0 -0
  80. data/lib/nekohtml.jar +0 -0
  81. data/lib/nokogiri.rb +123 -0
  82. data/lib/nokogiri/css.rb +25 -0
  83. data/lib/nokogiri/css/generated_parser.rb +659 -0
  84. data/lib/nokogiri/css/generated_tokenizer.rb +145 -0
  85. data/lib/nokogiri/css/node.rb +99 -0
  86. data/lib/nokogiri/css/parser.rb +82 -0
  87. data/lib/nokogiri/css/parser.y +230 -0
  88. data/lib/nokogiri/css/syntax_error.rb +7 -0
  89. data/lib/nokogiri/css/tokenizer.rb +7 -0
  90. data/lib/nokogiri/css/tokenizer.rex +55 -0
  91. data/lib/nokogiri/css/xpath_visitor.rb +164 -0
  92. data/lib/nokogiri/decorators/slop.rb +33 -0
  93. data/lib/nokogiri/ffi/encoding_handler.rb +42 -0
  94. data/lib/nokogiri/ffi/html/document.rb +28 -0
  95. data/lib/nokogiri/ffi/html/element_description.rb +81 -0
  96. data/lib/nokogiri/ffi/html/entity_lookup.rb +16 -0
  97. data/lib/nokogiri/ffi/html/sax/parser_context.rb +38 -0
  98. data/lib/nokogiri/ffi/io_callbacks.rb +42 -0
  99. data/lib/nokogiri/ffi/libxml.rb +372 -0
  100. data/lib/nokogiri/ffi/structs/common_node.rb +26 -0
  101. data/lib/nokogiri/ffi/structs/html_elem_desc.rb +24 -0
  102. data/lib/nokogiri/ffi/structs/html_entity_desc.rb +13 -0
  103. data/lib/nokogiri/ffi/structs/xml_alloc.rb +16 -0
  104. data/lib/nokogiri/ffi/structs/xml_attr.rb +19 -0
  105. data/lib/nokogiri/ffi/structs/xml_attribute.rb +27 -0
  106. data/lib/nokogiri/ffi/structs/xml_buffer.rb +16 -0
  107. data/lib/nokogiri/ffi/structs/xml_char_encoding_handler.rb +11 -0
  108. data/lib/nokogiri/ffi/structs/xml_document.rb +108 -0
  109. data/lib/nokogiri/ffi/structs/xml_dtd.rb +28 -0
  110. data/lib/nokogiri/ffi/structs/xml_element.rb +26 -0
  111. data/lib/nokogiri/ffi/structs/xml_element_content.rb +17 -0
  112. data/lib/nokogiri/ffi/structs/xml_entity.rb +32 -0
  113. data/lib/nokogiri/ffi/structs/xml_enumeration.rb +12 -0
  114. data/lib/nokogiri/ffi/structs/xml_node.rb +28 -0
  115. data/lib/nokogiri/ffi/structs/xml_node_set.rb +53 -0
  116. data/lib/nokogiri/ffi/structs/xml_notation.rb +11 -0
  117. data/lib/nokogiri/ffi/structs/xml_ns.rb +15 -0
  118. data/lib/nokogiri/ffi/structs/xml_parser_context.rb +19 -0
  119. data/lib/nokogiri/ffi/structs/xml_relax_ng.rb +14 -0
  120. data/lib/nokogiri/ffi/structs/xml_sax_handler.rb +51 -0
  121. data/lib/nokogiri/ffi/structs/xml_sax_push_parser_context.rb +124 -0
  122. data/lib/nokogiri/ffi/structs/xml_schema.rb +13 -0
  123. data/lib/nokogiri/ffi/structs/xml_syntax_error.rb +31 -0
  124. data/lib/nokogiri/ffi/structs/xml_text_reader.rb +12 -0
  125. data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +37 -0
  126. data/lib/nokogiri/ffi/structs/xml_xpath_object.rb +35 -0
  127. data/lib/nokogiri/ffi/structs/xml_xpath_parser_context.rb +20 -0
  128. data/lib/nokogiri/ffi/structs/xslt_stylesheet.rb +13 -0
  129. data/lib/nokogiri/ffi/xml/attr.rb +41 -0
  130. data/lib/nokogiri/ffi/xml/attribute_decl.rb +27 -0
  131. data/lib/nokogiri/ffi/xml/cdata.rb +19 -0
  132. data/lib/nokogiri/ffi/xml/comment.rb +18 -0
  133. data/lib/nokogiri/ffi/xml/document.rb +135 -0
  134. data/lib/nokogiri/ffi/xml/document_fragment.rb +21 -0
  135. data/lib/nokogiri/ffi/xml/dtd.rb +67 -0
  136. data/lib/nokogiri/ffi/xml/element_content.rb +43 -0
  137. data/lib/nokogiri/ffi/xml/element_decl.rb +19 -0
  138. data/lib/nokogiri/ffi/xml/entity_decl.rb +27 -0
  139. data/lib/nokogiri/ffi/xml/entity_reference.rb +19 -0
  140. data/lib/nokogiri/ffi/xml/namespace.rb +44 -0
  141. data/lib/nokogiri/ffi/xml/node.rb +465 -0
  142. data/lib/nokogiri/ffi/xml/node_set.rb +146 -0
  143. data/lib/nokogiri/ffi/xml/processing_instruction.rb +20 -0
  144. data/lib/nokogiri/ffi/xml/reader.rb +227 -0
  145. data/lib/nokogiri/ffi/xml/relax_ng.rb +85 -0
  146. data/lib/nokogiri/ffi/xml/sax/parser.rb +135 -0
  147. data/lib/nokogiri/ffi/xml/sax/parser_context.rb +67 -0
  148. data/lib/nokogiri/ffi/xml/sax/push_parser.rb +55 -0
  149. data/lib/nokogiri/ffi/xml/schema.rb +92 -0
  150. data/lib/nokogiri/ffi/xml/syntax_error.rb +98 -0
  151. data/lib/nokogiri/ffi/xml/text.rb +18 -0
  152. data/lib/nokogiri/ffi/xml/xpath.rb +19 -0
  153. data/lib/nokogiri/ffi/xml/xpath_context.rb +135 -0
  154. data/lib/nokogiri/ffi/xslt/stylesheet.rb +50 -0
  155. data/lib/nokogiri/html.rb +36 -0
  156. data/lib/nokogiri/html/builder.rb +35 -0
  157. data/lib/nokogiri/html/document.rb +88 -0
  158. data/lib/nokogiri/html/document_fragment.rb +15 -0
  159. data/lib/nokogiri/html/element_description.rb +23 -0
  160. data/lib/nokogiri/html/element_description_defaults.rb +671 -0
  161. data/lib/nokogiri/html/entity_lookup.rb +13 -0
  162. data/lib/nokogiri/html/sax/parser.rb +48 -0
  163. data/lib/nokogiri/html/sax/parser_context.rb +16 -0
  164. data/lib/nokogiri/nokogiri.jar +0 -0
  165. data/lib/nokogiri/syntax_error.rb +4 -0
  166. data/lib/nokogiri/version.rb +33 -0
  167. data/lib/nokogiri/version_warning.rb +11 -0
  168. data/lib/nokogiri/xml.rb +67 -0
  169. data/lib/nokogiri/xml/attr.rb +14 -0
  170. data/lib/nokogiri/xml/attribute_decl.rb +18 -0
  171. data/lib/nokogiri/xml/builder.rb +405 -0
  172. data/lib/nokogiri/xml/cdata.rb +11 -0
  173. data/lib/nokogiri/xml/character_data.rb +7 -0
  174. data/lib/nokogiri/xml/document.rb +163 -0
  175. data/lib/nokogiri/xml/document_fragment.rb +73 -0
  176. data/lib/nokogiri/xml/dtd.rb +11 -0
  177. data/lib/nokogiri/xml/element_content.rb +36 -0
  178. data/lib/nokogiri/xml/element_decl.rb +13 -0
  179. data/lib/nokogiri/xml/entity_decl.rb +15 -0
  180. data/lib/nokogiri/xml/fragment_handler.rb +73 -0
  181. data/lib/nokogiri/xml/namespace.rb +13 -0
  182. data/lib/nokogiri/xml/node.rb +730 -0
  183. data/lib/nokogiri/xml/node/save_options.rb +42 -0
  184. data/lib/nokogiri/xml/node_set.rb +318 -0
  185. data/lib/nokogiri/xml/notation.rb +6 -0
  186. data/lib/nokogiri/xml/parse_options.rb +85 -0
  187. data/lib/nokogiri/xml/pp.rb +2 -0
  188. data/lib/nokogiri/xml/pp/character_data.rb +18 -0
  189. data/lib/nokogiri/xml/pp/node.rb +56 -0
  190. data/lib/nokogiri/xml/processing_instruction.rb +8 -0
  191. data/lib/nokogiri/xml/reader.rb +74 -0
  192. data/lib/nokogiri/xml/relax_ng.rb +32 -0
  193. data/lib/nokogiri/xml/sax.rb +4 -0
  194. data/lib/nokogiri/xml/sax/document.rb +160 -0
  195. data/lib/nokogiri/xml/sax/parser.rb +115 -0
  196. data/lib/nokogiri/xml/sax/parser_context.rb +16 -0
  197. data/lib/nokogiri/xml/sax/push_parser.rb +60 -0
  198. data/lib/nokogiri/xml/schema.rb +61 -0
  199. data/lib/nokogiri/xml/syntax_error.rb +43 -0
  200. data/lib/nokogiri/xml/xpath.rb +10 -0
  201. data/lib/nokogiri/xml/xpath/syntax_error.rb +8 -0
  202. data/lib/nokogiri/xml/xpath_context.rb +16 -0
  203. data/lib/nokogiri/xslt.rb +48 -0
  204. data/lib/nokogiri/xslt/stylesheet.rb +25 -0
  205. data/lib/xercesImpl.jar +0 -0
  206. data/lib/xsd/xmlparser/nokogiri.rb +90 -0
  207. data/tasks/test.rb +100 -0
  208. data/test/css/test_nthiness.rb +159 -0
  209. data/test/css/test_parser.rb +282 -0
  210. data/test/css/test_tokenizer.rb +190 -0
  211. data/test/css/test_xpath_visitor.rb +76 -0
  212. data/test/ffi/test_document.rb +35 -0
  213. data/test/files/2ch.html +108 -0
  214. data/test/files/address_book.rlx +12 -0
  215. data/test/files/address_book.xml +10 -0
  216. data/test/files/bar/bar.xsd +4 -0
  217. data/test/files/dont_hurt_em_why.xml +422 -0
  218. data/test/files/exslt.xml +8 -0
  219. data/test/files/exslt.xslt +35 -0
  220. data/test/files/foo/foo.xsd +4 -0
  221. data/test/files/po.xml +32 -0
  222. data/test/files/po.xsd +66 -0
  223. data/test/files/shift_jis.html +10 -0
  224. data/test/files/shift_jis.xml +5 -0
  225. data/test/files/snuggles.xml +3 -0
  226. data/test/files/staff.dtd +10 -0
  227. data/test/files/staff.xml +59 -0
  228. data/test/files/staff.xslt +32 -0
  229. data/test/files/tlm.html +850 -0
  230. data/test/files/valid_bar.xml +2 -0
  231. data/test/helper.rb +137 -0
  232. data/test/html/sax/test_parser.rb +83 -0
  233. data/test/html/sax/test_parser_context.rb +48 -0
  234. data/test/html/test_builder.rb +164 -0
  235. data/test/html/test_document.rb +385 -0
  236. data/test/html/test_document_encoding.rb +77 -0
  237. data/test/html/test_document_fragment.rb +157 -0
  238. data/test/html/test_element_description.rb +98 -0
  239. data/test/html/test_named_characters.rb +14 -0
  240. data/test/html/test_node.rb +242 -0
  241. data/test/html/test_node_encoding.rb +27 -0
  242. data/test/test_convert_xpath.rb +135 -0
  243. data/test/test_css_cache.rb +45 -0
  244. data/test/test_encoding_handler.rb +46 -0
  245. data/test/test_jruby.rb +40 -0
  246. data/test/test_memory_leak.rb +87 -0
  247. data/test/test_nokogiri.rb +140 -0
  248. data/test/test_reader.rb +358 -0
  249. data/test/test_soap4r_sax.rb +52 -0
  250. data/test/test_xslt_transforms.rb +150 -0
  251. data/test/xml/node/test_save_options.rb +20 -0
  252. data/test/xml/node/test_subclass.rb +44 -0
  253. data/test/xml/sax/test_parser.rb +314 -0
  254. data/test/xml/sax/test_parser_context.rb +63 -0
  255. data/test/xml/sax/test_push_parser.rb +135 -0
  256. data/test/xml/test_attr.rb +38 -0
  257. data/test/xml/test_attribute_decl.rb +90 -0
  258. data/test/xml/test_builder.rb +167 -0
  259. data/test/xml/test_cdata.rb +38 -0
  260. data/test/xml/test_comment.rb +29 -0
  261. data/test/xml/test_document.rb +638 -0
  262. data/test/xml/test_document_encoding.rb +26 -0
  263. data/test/xml/test_document_fragment.rb +149 -0
  264. data/test/xml/test_dtd.rb +92 -0
  265. data/test/xml/test_dtd_encoding.rb +33 -0
  266. data/test/xml/test_element_content.rb +56 -0
  267. data/test/xml/test_element_decl.rb +73 -0
  268. data/test/xml/test_entity_decl.rb +83 -0
  269. data/test/xml/test_entity_reference.rb +21 -0
  270. data/test/xml/test_namespace.rb +70 -0
  271. data/test/xml/test_node.rb +740 -0
  272. data/test/xml/test_node_attributes.rb +34 -0
  273. data/test/xml/test_node_encoding.rb +107 -0
  274. data/test/xml/test_node_reparenting.rb +279 -0
  275. data/test/xml/test_node_set.rb +577 -0
  276. data/test/xml/test_parse_options.rb +52 -0
  277. data/test/xml/test_processing_instruction.rb +30 -0
  278. data/test/xml/test_reader_encoding.rb +126 -0
  279. data/test/xml/test_relax_ng.rb +60 -0
  280. data/test/xml/test_schema.rb +89 -0
  281. data/test/xml/test_syntax_error.rb +12 -0
  282. data/test/xml/test_text.rb +30 -0
  283. data/test/xml/test_unparented_node.rb +381 -0
  284. data/test/xml/test_xpath.rb +169 -0
  285. metadata +477 -0
@@ -0,0 +1,19 @@
1
+ module Nokogiri
2
+ module XML
3
+ class CDATA < Text
4
+
5
+ def self.new(document, content, *rest) # :nodoc:
6
+ length = content.nil? ? 0 : content.length
7
+ node_ptr = LibXML.xmlNewCDataBlock(document.cstruct[:doc], content, length)
8
+ node_cstruct = LibXML::XmlNode.new(node_ptr)
9
+ node_cstruct.keep_reference_from_document!
10
+
11
+ node = Node.wrap(node_cstruct, self)
12
+ node.send :initialize, document, content, *rest
13
+ yield node if block_given?
14
+ node
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Nokogiri
2
+ module XML
3
+ class Comment < CharacterData
4
+
5
+ def self.new(document, content, *rest) # :nodoc:
6
+ node_ptr = LibXML.xmlNewDocComment(document.cstruct, content)
7
+ node_cstruct = LibXML::XmlNode.new(node_ptr)
8
+ node_cstruct.keep_reference_from_document!
9
+
10
+ node = Node.wrap(node_ptr, self)
11
+ node.send :initialize, document, content, *rest
12
+ yield node if block_given?
13
+ node
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,135 @@
1
+ # :stopdoc:
2
+ module Nokogiri
3
+ module XML
4
+ class Document < Node
5
+
6
+ attr_accessor :cstruct
7
+
8
+ def url
9
+ cstruct[:URL]
10
+ end
11
+
12
+ def root= new_root
13
+ old_root = nil
14
+ if new_root.cstruct[:doc] != cstruct[:doc]
15
+ old_root_ptr = LibXML.xmlDocGetRootElement(cstruct)
16
+ new_root_ptr = LibXML.xmlDocCopyNode(new_root.cstruct, cstruct, 1)
17
+ raise RuntimeError "Could not reparent node (xmlDocCopyNode)" if new_root_ptr.null?
18
+ new_root = Node.wrap(new_root_ptr)
19
+ end
20
+ LibXML.xmlDocSetRootElement(cstruct, new_root.cstruct)
21
+ if old_root_ptr && ! old_root_ptr.null?
22
+ LibXML::XmlNode.new(old_root_ptr).keep_reference_from_document!
23
+ end
24
+ new_root
25
+ end
26
+
27
+ def root
28
+ ptr = LibXML.xmlDocGetRootElement(cstruct)
29
+ ptr.null? ? nil : Node.wrap(LibXML::XmlNode.new(ptr))
30
+ end
31
+
32
+ def encoding= encoding
33
+ # TODO: if :encoding is already set, then it's probably getting leaked.
34
+ cstruct[:encoding] = LibXML.xmlStrdup(encoding)
35
+ end
36
+
37
+ def encoding
38
+ ptr = cstruct[:encoding]
39
+ ptr.null? ? nil : ptr.read_string
40
+ end
41
+
42
+ def version
43
+ cstruct[:version]
44
+ end
45
+
46
+ def self.read_io io, url, encoding, options
47
+ wrap_with_error_handling do
48
+ LibXML.xmlReadIO(IoCallbacks.reader(io), nil, nil, url, encoding, options)
49
+ end
50
+ end
51
+
52
+ def self.read_memory(string, url, encoding, options)
53
+ wrap_with_error_handling do
54
+ LibXML.xmlReadMemory(string, string.length, url, encoding, options)
55
+ end
56
+ end
57
+
58
+ def dup deep = 1
59
+ dup_ptr = LibXML.xmlCopyDoc(cstruct, deep)
60
+ return nil if dup_ptr.null?
61
+
62
+ # xmlCopyDoc does not preserve document type. wtf?
63
+ cstruct = LibXML::XmlDocumentCast.new(dup_ptr)
64
+ cstruct[:type] = self.type
65
+
66
+ self.class.wrap(dup_ptr)
67
+ end
68
+
69
+ def remove_namespaces!
70
+ self.class.recursively_remove_namespaces_from_node(root)
71
+ end
72
+
73
+ class << self
74
+ def new(*args)
75
+ version = args.first || "1.0"
76
+ doc = wrap(LibXML.xmlNewDoc(version))
77
+ doc.send :initialize, *args
78
+ doc
79
+ end
80
+
81
+ def wrap doc_struct
82
+ if doc_struct.is_a?(FFI::Pointer)
83
+ # cast native pointers up into a doc cstruct
84
+ return nil if doc_struct.null?
85
+ doc_struct = LibXML::XmlDocument.new(doc_struct)
86
+ end
87
+
88
+ doc = self.allocate
89
+ doc.cstruct = doc_struct
90
+ doc.cstruct.ruby_doc = doc
91
+ doc.instance_eval { @decorators = nil; @node_cache = [] }
92
+ doc.send :initialize
93
+ doc
94
+ end
95
+ end
96
+
97
+ private
98
+
99
+ class << self
100
+ def wrap_with_error_handling(&block)
101
+ error_list = []
102
+ LibXML.xmlInitParser()
103
+ LibXML.xmlResetLastError()
104
+ LibXML.xmlSetStructuredErrorFunc(nil, SyntaxError.error_array_pusher(error_list))
105
+
106
+ ptr = yield
107
+
108
+ LibXML.xmlSetStructuredErrorFunc(nil, nil)
109
+
110
+ if ptr.null?
111
+ error = LibXML.xmlGetLastError()
112
+ if error
113
+ raise SyntaxError.wrap(error)
114
+ else
115
+ raise RuntimeError, "Could not parse document"
116
+ end
117
+ end
118
+
119
+ document = wrap(ptr)
120
+ document.errors = error_list
121
+ return document
122
+ end
123
+
124
+ def recursively_remove_namespaces_from_node(node)
125
+ node.cstruct[:ns] = nil
126
+ node.children.each do |child|
127
+ recursively_remove_namespaces_from_node(child)
128
+ end
129
+ end
130
+ end
131
+
132
+ end
133
+ end
134
+ end
135
+ # :startdoc:
@@ -0,0 +1,21 @@
1
+ module Nokogiri
2
+ module XML
3
+ class DocumentFragment < Node
4
+
5
+ def self.new(document, *rest) # :nodoc:
6
+ node_ptr = LibXML.xmlNewDocFragment(document.cstruct)
7
+ node_cstruct = LibXML::XmlNode.new(node_ptr)
8
+ node_cstruct.keep_reference_from_document!
9
+
10
+ node = Node.wrap(node_cstruct, self)
11
+
12
+ node.send :initialize, document, *rest
13
+ yield node if block_given?
14
+
15
+ node
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,67 @@
1
+ # :stopdoc:
2
+ module Nokogiri
3
+ module XML
4
+ class DTD < Node
5
+ def validate document
6
+ error_list = []
7
+ ctxt = LibXML.xmlNewValidCtxt
8
+
9
+ LibXML.xmlSetStructuredErrorFunc(nil, SyntaxError.error_array_pusher(error_list))
10
+ LibXML.xmlValidateDtd ctxt, document.cstruct, cstruct
11
+
12
+ LibXML.xmlSetStructuredErrorFunc nil, nil
13
+
14
+ LibXML.xmlFreeValidCtxt ctxt
15
+
16
+ error_list
17
+ end
18
+
19
+ def system_id
20
+ cstruct[:system_id]
21
+ end
22
+
23
+ def external_id
24
+ cstruct[:external_id]
25
+ end
26
+
27
+ def elements
28
+ internal_attributes :elements
29
+ end
30
+
31
+ def entities
32
+ internal_attributes :entities
33
+ end
34
+
35
+ def attributes
36
+ internal_attributes :attributes
37
+ end
38
+
39
+ def notations
40
+ attr_ptr = cstruct[:notations]
41
+ return nil if attr_ptr.null?
42
+
43
+ ahash = {}
44
+ LibXML.xmlHashScan(attr_ptr, nil) do |payload, data, name|
45
+ notation_cstruct = LibXML::XmlNotation.new(payload)
46
+ ahash[name] = Notation.new(notation_cstruct[:name], notation_cstruct[:PublicID],
47
+ notation_cstruct[:SystemID])
48
+ end
49
+ ahash
50
+ end
51
+
52
+ private
53
+
54
+ def internal_attributes attr_name
55
+ attr_ptr = cstruct[attr_name.to_sym]
56
+ return nil if attr_ptr.null?
57
+
58
+ ahash = {}
59
+ LibXML.xmlHashScan(attr_ptr, nil) do |payload, data, name|
60
+ ahash[name] = Node.wrap(payload)
61
+ end
62
+ ahash
63
+ end
64
+ end
65
+ end
66
+ end
67
+ # :startdoc:
@@ -0,0 +1,43 @@
1
+ # :stopdoc:
2
+ module Nokogiri
3
+ module XML
4
+ class ElementContent
5
+ attr_accessor :cstruct
6
+
7
+ def self.wrap pointer, document
8
+ return nil if pointer.null?
9
+
10
+ c = ElementContent.allocate
11
+ c.cstruct = LibXML::XmlElementContent.new pointer
12
+ c.instance_variable_set :@document, document
13
+ c
14
+ end
15
+
16
+ def type
17
+ cstruct[:type]
18
+ end
19
+
20
+ def prefix
21
+ cstruct[:prefix]
22
+ end
23
+
24
+ def occur
25
+ cstruct[:ocur]
26
+ end
27
+
28
+ def name
29
+ cstruct[:name]
30
+ end
31
+
32
+ private
33
+ def c1
34
+ self.class.wrap cstruct[:c1], document
35
+ end
36
+
37
+ def c2
38
+ self.class.wrap cstruct[:c2], document
39
+ end
40
+ end
41
+ end
42
+ end
43
+ # :startdoc:
@@ -0,0 +1,19 @@
1
+ # :stopdoc:
2
+ module Nokogiri
3
+ module XML
4
+ class ElementDecl < Nokogiri::XML::Node
5
+ def element_type
6
+ cstruct[:etype]
7
+ end
8
+
9
+ def prefix
10
+ cstruct[:prefix]
11
+ end
12
+
13
+ def content
14
+ ElementContent.wrap cstruct[:content], document
15
+ end
16
+ end
17
+ end
18
+ end
19
+ # :startdoc:
@@ -0,0 +1,27 @@
1
+ # :stopdoc:
2
+ module Nokogiri
3
+ module XML
4
+ class EntityDecl < Nokogiri::XML::Node
5
+ def content
6
+ cstruct[:content]
7
+ end
8
+
9
+ def entity_type
10
+ cstruct[:etype]
11
+ end
12
+
13
+ def external_id
14
+ cstruct[:external_id]
15
+ end
16
+
17
+ def system_id
18
+ cstruct[:system_id]
19
+ end
20
+
21
+ def original_content
22
+ cstruct[:orig]
23
+ end
24
+ end
25
+ end
26
+ end
27
+ # :startdoc:
@@ -0,0 +1,19 @@
1
+ module Nokogiri
2
+ module XML
3
+ class EntityReference < Node
4
+
5
+ def self.new(document, name, *rest) # :nodoc:
6
+ node_ptr = LibXML.xmlNewReference(document.cstruct, name)
7
+ node_cstruct = LibXML::XmlNode.new(node_ptr)
8
+ node_cstruct.keep_reference_from_document!
9
+
10
+ node = Node.wrap(node_cstruct, self)
11
+ node.send :initialize, document, name, *rest
12
+ yield node if block_given?
13
+ node
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,44 @@
1
+ module Nokogiri
2
+ module XML
3
+ class Namespace
4
+ # :stopdoc:
5
+
6
+ attr_accessor :cstruct
7
+ attr_accessor :document
8
+
9
+ def prefix
10
+ cstruct[:prefix].nil? ? nil : cstruct[:prefix] # TODO: encoding?
11
+ end
12
+
13
+ def href
14
+ cstruct[:href].nil? ? nil : cstruct[:href] # TODO: encoding?
15
+ end
16
+
17
+ class << self
18
+ def wrap(document, node_struct)
19
+ if node_struct.is_a?(FFI::Pointer)
20
+ # cast native pointers up into a node cstruct
21
+ return nil if node_struct.null?
22
+ node_struct = LibXML::XmlNs.new(node_struct)
23
+ end
24
+
25
+ ruby_node = node_struct.ruby_node
26
+ return ruby_node unless ruby_node.nil?
27
+
28
+ ns = Nokogiri::XML::Namespace.allocate
29
+ ns.document = document.ruby_doc
30
+ ns.cstruct = node_struct
31
+
32
+ ns.cstruct.ruby_node = ns
33
+
34
+ cache = ns.document.instance_variable_get(:@node_cache)
35
+ cache << ns
36
+
37
+ ns
38
+ end
39
+ end
40
+
41
+ # :startdoc:
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,465 @@
1
+ module Nokogiri
2
+ module XML
3
+ class Node
4
+ # :stopdoc:
5
+
6
+ attr_accessor :cstruct
7
+
8
+ def pointer_id
9
+ cstruct.pointer
10
+ end
11
+
12
+ def encode_special_chars(string)
13
+ char_ptr = LibXML.xmlEncodeSpecialChars(self[:doc], string)
14
+ encoded = char_ptr.read_string
15
+ # TODO: encoding?
16
+ LibXML.xmlFree(char_ptr)
17
+ encoded
18
+ end
19
+
20
+ def internal_subset
21
+ doc = cstruct.document
22
+ dtd = LibXML.xmlGetIntSubset(doc)
23
+ return nil if dtd.null?
24
+ Node.wrap(dtd)
25
+ end
26
+
27
+ def external_subset
28
+ doc = cstruct.document
29
+ return nil if doc[:extSubset].null?
30
+
31
+ Node.wrap(doc[:extSubset])
32
+ end
33
+
34
+ def create_internal_subset name, external_id, system_id
35
+ raise("Document already has an internal subset") if internal_subset
36
+
37
+ doc = cstruct.document
38
+ dtd_ptr = LibXML.xmlCreateIntSubset doc, name, external_id, system_id
39
+
40
+ return nil if dtd_ptr.null?
41
+
42
+ Node.wrap dtd_ptr
43
+ end
44
+
45
+ def create_external_subset name, external_id, system_id
46
+ raise("Document already has an external subset") if external_subset
47
+
48
+ doc = cstruct.document
49
+ dtd_ptr = LibXML.xmlNewDtd doc, name, external_id, system_id
50
+
51
+ return nil if dtd_ptr.null?
52
+
53
+ Node.wrap dtd_ptr
54
+ end
55
+
56
+ def dup(deep = 1)
57
+ dup_ptr = LibXML.xmlDocCopyNode(cstruct, cstruct.document, deep)
58
+ return nil if dup_ptr.null?
59
+ Node.wrap(dup_ptr, self.class)
60
+ end
61
+
62
+ def unlink
63
+ LibXML.xmlUnlinkNode(cstruct)
64
+ cstruct.keep_reference_from_document!
65
+ self
66
+ end
67
+
68
+ def blank?
69
+ LibXML.xmlIsBlankNode(cstruct) == 1
70
+ end
71
+
72
+ def next_sibling
73
+ cstruct_node_from :next
74
+ end
75
+
76
+ def previous_sibling
77
+ cstruct_node_from :prev
78
+ end
79
+
80
+ def next_element
81
+ sibling_ptr = cstruct[:next]
82
+
83
+ while ! sibling_ptr.null?
84
+ sibling_cstruct = LibXML::XmlNode.new(sibling_ptr)
85
+ break if sibling_cstruct[:type] == ELEMENT_NODE
86
+ sibling_ptr = sibling_cstruct[:next]
87
+ end
88
+
89
+ return sibling_ptr.null? ? nil : Node.wrap(sibling_ptr)
90
+ end
91
+
92
+ def previous_element
93
+ sibling_ptr = cstruct[:prev]
94
+
95
+ while ! sibling_ptr.null?
96
+ sibling_cstruct = LibXML::XmlNode.new(sibling_ptr)
97
+ break if sibling_cstruct[:type] == ELEMENT_NODE
98
+ sibling_ptr = sibling_cstruct[:prev]
99
+ end
100
+
101
+ return sibling_ptr.null? ? nil : Node.wrap(sibling_ptr)
102
+ end
103
+
104
+ def replace_node new_node
105
+ Node.reparent_node_with(new_node, self) do |new_node_cstruct, self_cstruct|
106
+ retval = LibXML.xmlReplaceNode(self_cstruct, new_node_cstruct)
107
+ if retval == self_cstruct.pointer
108
+ new_node_cstruct # for reparent_node_with semantics
109
+ else
110
+ retval
111
+ end
112
+ end
113
+ self
114
+ end
115
+
116
+ def children
117
+ return NodeSet.new(nil) if cstruct[:children].null?
118
+ child = Node.wrap(cstruct[:children])
119
+
120
+ set = NodeSet.new child.document
121
+ set_ptr = LibXML.xmlXPathNodeSetCreate(child.cstruct)
122
+
123
+ set.cstruct = LibXML::XmlNodeSet.new(set_ptr)
124
+ return set unless child
125
+
126
+ child_ptr = child.cstruct[:next]
127
+ while ! child_ptr.null?
128
+ child = Node.wrap(child_ptr)
129
+ LibXML.xmlXPathNodeSetAdd(set.cstruct, child.cstruct)
130
+ child_ptr = child.cstruct[:next]
131
+ end
132
+
133
+ return set
134
+ end
135
+
136
+ def child
137
+ (val = cstruct[:children]).null? ? nil : Node.wrap(val)
138
+ end
139
+
140
+ def key?(attribute)
141
+ ! (prop = LibXML.xmlHasProp(cstruct, attribute.to_s)).null?
142
+ end
143
+
144
+ def namespaced_key?(attribute, namespace)
145
+ prop = LibXML.xmlHasNsProp(cstruct, attribute.to_s,
146
+ namespace.nil? ? nil : namespace.to_s)
147
+ !prop.null?
148
+ end
149
+
150
+ def []=(property, value)
151
+ LibXML.xmlSetProp(cstruct, property, value)
152
+ value
153
+ end
154
+
155
+ def get(attribute)
156
+ return nil unless attribute
157
+ propstr = LibXML.xmlGetProp(cstruct, attribute.to_s)
158
+ return nil if propstr.null?
159
+ rval = propstr.read_string # TODO: encoding?
160
+ LibXML.xmlFree(propstr)
161
+ rval
162
+ end
163
+
164
+ def set_namespace(namespace)
165
+ LibXML.xmlSetNs(cstruct, namespace.cstruct)
166
+ self
167
+ end
168
+
169
+ def attribute(name)
170
+ attribute_nodes.find { |x| x.name == name }
171
+ end
172
+
173
+ def attribute_with_ns(name, namespace)
174
+ prop = LibXML.xmlHasNsProp(cstruct, name.to_s,
175
+ namespace.nil? ? NULL : namespace.to_s)
176
+ return prop if prop.null?
177
+ Node.wrap(prop)
178
+ end
179
+
180
+ def attribute_nodes
181
+ Node.node_properties cstruct
182
+ end
183
+
184
+ def namespace
185
+ cstruct[:ns].null? ? nil : Namespace.wrap(cstruct.document, cstruct[:ns])
186
+ end
187
+
188
+ def namespace_definitions
189
+ list = []
190
+ ns_ptr = cstruct[:nsDef]
191
+ return list if ns_ptr.null?
192
+ while ! ns_ptr.null?
193
+ ns = Namespace.wrap(cstruct.document, ns_ptr)
194
+ list << ns
195
+ ns_ptr = ns.cstruct[:next]
196
+ end
197
+ list
198
+ end
199
+
200
+ def node_type
201
+ cstruct[:type]
202
+ end
203
+
204
+ def native_content=(content)
205
+ LibXML.xmlNodeSetContent(cstruct, content)
206
+ content
207
+ end
208
+
209
+ def content
210
+ content_ptr = LibXML.xmlNodeGetContent(cstruct)
211
+ return nil if content_ptr.null?
212
+ content = content_ptr.read_string # TODO: encoding?
213
+ LibXML.xmlFree(content_ptr)
214
+ content
215
+ end
216
+
217
+ def add_child_node child
218
+ Node.reparent_node_with(child, self) do |child_cstruct, my_cstruct|
219
+ LibXML.xmlAddChild(my_cstruct, child_cstruct)
220
+ end
221
+ end
222
+
223
+ def parent
224
+ cstruct_node_from :parent
225
+ end
226
+
227
+ def node_name=(string)
228
+ LibXML.xmlNodeSetName(cstruct, string)
229
+ string
230
+ end
231
+
232
+ def node_name
233
+ cstruct[:name] # TODO: encoding?
234
+ end
235
+
236
+ def path
237
+ path_ptr = LibXML.xmlGetNodePath(cstruct)
238
+ val = path_ptr.null? ? nil : path_ptr.read_string # TODO: encoding?
239
+ LibXML.xmlFree(path_ptr)
240
+ val
241
+ end
242
+
243
+ def add_next_sibling_node next_sibling
244
+ Node.reparent_node_with(next_sibling, self) do |sibling_cstruct, my_cstruct|
245
+ LibXML.xmlAddNextSibling(my_cstruct, sibling_cstruct)
246
+ end
247
+ end
248
+
249
+ def add_previous_sibling_node prev_sibling
250
+ Node.reparent_node_with(prev_sibling, self) do |sibling_cstruct, my_cstruct|
251
+ LibXML.xmlAddPrevSibling(my_cstruct, sibling_cstruct)
252
+ end
253
+ end
254
+
255
+ def native_write_to(io, encoding, indent_string, options)
256
+ set_xml_indent_tree_output 1
257
+ set_xml_tree_indent_string indent_string
258
+ savectx = LibXML.xmlSaveToIO(IoCallbacks.writer(io), nil, nil, encoding, options)
259
+ LibXML.xmlSaveTree(savectx, cstruct)
260
+ LibXML.xmlSaveClose(savectx)
261
+ io
262
+ end
263
+
264
+ def line
265
+ cstruct[:line]
266
+ end
267
+
268
+ def add_namespace_definition(prefix, href)
269
+ ns = LibXML.xmlNewNs(cstruct, href, prefix)
270
+ if ns.null?
271
+ ns = LibXML.xmlSearchNs(cstruct.document, cstruct,
272
+ prefix.nil? ? nil : prefix.to_s)
273
+ end
274
+ LibXML.xmlSetNs(cstruct, ns) if prefix.nil?
275
+ Namespace.wrap(cstruct.document, ns)
276
+ end
277
+
278
+ def self.new(name, doc, *rest)
279
+ ptr = LibXML.xmlNewNode(nil, name.to_s)
280
+
281
+ node_cstruct = LibXML::XmlNode.new(ptr)
282
+ node_cstruct[:doc] = doc.cstruct[:doc]
283
+ node_cstruct.keep_reference_from_document!
284
+
285
+ node = Node.wrap(
286
+ node_cstruct,
287
+ Node == self ? nil : self
288
+ )
289
+ node.send :initialize, name, doc, *rest
290
+ yield node if block_given?
291
+ node
292
+ end
293
+
294
+ def dump_html
295
+ return to_xml if type == DOCUMENT_NODE
296
+ buffer = LibXML::XmlBuffer.new(LibXML.xmlBufferCreate())
297
+ LibXML.htmlNodeDump(buffer, cstruct[:doc], cstruct)
298
+ buffer[:content] # TODO: encoding?
299
+ end
300
+
301
+ def compare(other)
302
+ LibXML.xmlXPathCmpNodes(other.cstruct, self.cstruct)
303
+ end
304
+
305
+ def self.wrap(node_struct, klass=nil)
306
+ if node_struct.is_a?(FFI::Pointer)
307
+ # cast native pointers up into a node cstruct
308
+ return nil if node_struct.null?
309
+ node_struct = LibXML::XmlNode.new(node_struct)
310
+ end
311
+
312
+ raise "wrapping a node without a document" unless node_struct.document
313
+
314
+ document_struct = node_struct.document
315
+ document_obj = document_struct.nil? ? nil : document_struct.ruby_doc
316
+ if node_struct[:type] == DOCUMENT_NODE || node_struct[:type] == HTML_DOCUMENT_NODE
317
+ return document_obj
318
+ end
319
+
320
+ ruby_node = node_struct.ruby_node
321
+ return ruby_node unless ruby_node.nil?
322
+
323
+ klasses = case node_struct[:type]
324
+ when ELEMENT_NODE then [XML::Element]
325
+ when TEXT_NODE then [XML::Text]
326
+ when ENTITY_REF_NODE then [XML::EntityReference]
327
+ when ATTRIBUTE_DECL then [XML::AttributeDecl, LibXML::XmlAttribute]
328
+ when ELEMENT_DECL then [XML::ElementDecl, LibXML::XmlElement]
329
+ when COMMENT_NODE then [XML::Comment]
330
+ when DOCUMENT_FRAG_NODE then [XML::DocumentFragment]
331
+ when PI_NODE then [XML::ProcessingInstruction]
332
+ when ATTRIBUTE_NODE then [XML::Attr]
333
+ when ENTITY_DECL then [XML::EntityDecl, LibXML::XmlEntity]
334
+ when CDATA_SECTION_NODE then [XML::CDATA]
335
+ when DTD_NODE then [XML::DTD, LibXML::XmlDtd]
336
+ else [XML::Node]
337
+ end
338
+
339
+ if klass
340
+ node = klass.allocate
341
+ else
342
+ node = klasses.first.allocate
343
+ end
344
+ node.cstruct = klasses[1] ? klasses[1].new(node_struct.pointer) : node_struct
345
+
346
+ node.cstruct.ruby_node = node
347
+
348
+ if document_obj
349
+ node.instance_variable_set(:@document, document_obj)
350
+ cache = document_obj.instance_variable_get(:@node_cache)
351
+ cache << node
352
+ document_obj.decorate(node)
353
+ end
354
+
355
+ node
356
+ end
357
+
358
+ def document
359
+ cstruct.document.ruby_doc
360
+ end
361
+
362
+ class << self
363
+ def node_properties(cstruct)
364
+ attr = []
365
+ prop_cstruct = cstruct[:properties]
366
+ while ! prop_cstruct.null?
367
+ prop = Node.wrap(prop_cstruct)
368
+ attr << prop
369
+ prop_cstruct = prop.cstruct[:next]
370
+ end
371
+ attr
372
+ end
373
+ end
374
+
375
+ private
376
+
377
+ def self.reparent_node_with(node, other, &block)
378
+ raise(ArgumentError, "node must be a Nokogiri::XML::Node") unless node.is_a?(Nokogiri::XML::Node)
379
+ raise(ArgumentError, "cannot reparent a document node") if node.node_type == DOCUMENT_NODE || node.node_type == HTML_DOCUMENT_NODE
380
+
381
+ if node.type == TEXT_NODE
382
+ node.cstruct.keep_reference_from_document!
383
+ node.cstruct = LibXML::XmlNode.new(LibXML.xmlDocCopyNode(node.cstruct, other.cstruct.document, 1))
384
+ end
385
+
386
+ if node.cstruct[:doc] == other.cstruct[:doc]
387
+ LibXML.xmlUnlinkNode(node.cstruct)
388
+ if node.type == TEXT_NODE && other.type == TEXT_NODE && Nokogiri.is_2_6_16?
389
+ other.cstruct.pointer.put_pointer(other.cstruct.offset_of(:content), LibXML.xmlStrdup(other.cstruct[:content]))
390
+ end
391
+ reparented_struct = block.call(node.cstruct, other.cstruct)
392
+ raise(RuntimeError, "Could not reparent node (1)") unless reparented_struct
393
+ else
394
+ duped_node = LibXML.xmlDocCopyNode(node.cstruct, other.cstruct.document, 1)
395
+ raise(RuntimeError, "Could not reparent node (xmlDocCopyNode)") unless duped_node
396
+ reparented_struct = block.call(duped_node, other.cstruct)
397
+ raise(RuntimeError, "Could not reparent node (2)") unless reparented_struct
398
+ LibXML.xmlUnlinkNode(node.cstruct)
399
+ node.cstruct.keep_reference_from_document!
400
+ end
401
+
402
+ reparented_struct = LibXML::XmlNode.new(reparented_struct) if reparented_struct.is_a?(FFI::Pointer)
403
+
404
+ # the child was a text node that was coalesced. we need to have the object
405
+ # point at SOMETHING, or we'll totally bomb out.
406
+ if reparented_struct != node.cstruct
407
+ node.cstruct = reparented_struct
408
+ end
409
+
410
+ relink_namespace reparented_struct
411
+
412
+ reparented = Node.wrap(reparented_struct)
413
+ reparented.decorate!
414
+ reparented
415
+ end
416
+
417
+ def self.relink_namespace(reparented_struct)
418
+ return if reparented_struct[:parent].null?
419
+
420
+ # Make sure that our reparented node has the correct namespaces
421
+ if reparented_struct[:ns].null? && reparented_struct[:doc] != reparented_struct[:parent]
422
+ LibXML.xmlSetNs(reparented_struct, LibXML::XmlNode.new(reparented_struct[:parent])[:ns])
423
+ end
424
+
425
+ # Search our parents for an existing definition
426
+ if ! reparented_struct[:nsDef].null?
427
+ ns = LibXML.xmlSearchNsByHref(
428
+ reparented_struct[:doc],
429
+ reparented_struct[:parent],
430
+ LibXML::XmlNs.new(reparented_struct[:nsDef])[:href]
431
+ )
432
+ reparented_struct[:nsDef] = nil unless ns.null?
433
+ end
434
+
435
+ # Only walk all children if there actually is a namespace we need to reparent.
436
+ return if reparented_struct[:ns].null?
437
+
438
+ # When a node gets reparented, walk it's children to make sure that
439
+ # their namespaces are reparented as well.
440
+ child_ptr = reparented_struct[:children]
441
+ while ! child_ptr.null?
442
+ child_struct = LibXML::XmlNode.new(child_ptr)
443
+ relink_namespace child_struct
444
+ child_ptr = child_struct[:next]
445
+ end
446
+ end
447
+
448
+ def cstruct_node_from(sym)
449
+ (val = cstruct[sym]).null? ? nil : Node.wrap(val)
450
+ end
451
+
452
+ def set_xml_indent_tree_output(value)
453
+ LibXML.__xmlIndentTreeOutput.write_int(value)
454
+ end
455
+
456
+ def set_xml_tree_indent_string(value)
457
+ LibXML.__xmlTreeIndentString.write_pointer(LibXML.xmlStrdup(value.to_s))
458
+ end
459
+
460
+ # :startdoc:
461
+ end
462
+ end
463
+ end
464
+ class Nokogiri::XML::Element < Nokogiri::XML::Node; end
465
+ class Nokogiri::XML::CharacterData < Nokogiri::XML::Node; end