nokogiri 1.4.1-x86-mswin32 → 1.4.2.1-x86-mswin32

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 (112) hide show
  1. data/CHANGELOG.ja.rdoc +45 -0
  2. data/CHANGELOG.rdoc +53 -1
  3. data/Manifest.txt +3 -3
  4. data/README.ja.rdoc +1 -1
  5. data/README.rdoc +11 -5
  6. data/Rakefile +13 -79
  7. data/ext/nokogiri/extconf.rb +25 -74
  8. data/ext/nokogiri/html_document.c +17 -8
  9. data/ext/nokogiri/html_element_description.c +20 -16
  10. data/ext/nokogiri/html_entity_lookup.c +2 -2
  11. data/ext/nokogiri/html_sax_parser_context.c +10 -8
  12. data/ext/nokogiri/nokogiri.c +0 -1
  13. data/ext/nokogiri/nokogiri.h +33 -28
  14. data/ext/nokogiri/xml_attr.c +7 -5
  15. data/ext/nokogiri/xml_attribute_decl.c +5 -2
  16. data/ext/nokogiri/xml_cdata.c +4 -2
  17. data/ext/nokogiri/xml_comment.c +4 -2
  18. data/ext/nokogiri/xml_document.c +93 -15
  19. data/ext/nokogiri/xml_document.h +0 -1
  20. data/ext/nokogiri/xml_document_fragment.c +4 -2
  21. data/ext/nokogiri/xml_dtd.c +18 -8
  22. data/ext/nokogiri/xml_element_content.c +2 -2
  23. data/ext/nokogiri/xml_entity_decl.c +15 -2
  24. data/ext/nokogiri/xml_entity_reference.c +4 -2
  25. data/ext/nokogiri/xml_io.c +1 -1
  26. data/ext/nokogiri/xml_namespace.c +5 -3
  27. data/ext/nokogiri/xml_node.c +353 -114
  28. data/ext/nokogiri/xml_node_set.c +35 -22
  29. data/ext/nokogiri/xml_node_set.h +1 -1
  30. data/ext/nokogiri/xml_processing_instruction.c +4 -2
  31. data/ext/nokogiri/xml_reader.c +119 -47
  32. data/ext/nokogiri/xml_relax_ng.c +21 -12
  33. data/ext/nokogiri/xml_sax_parser.c +6 -3
  34. data/ext/nokogiri/xml_sax_parser.h +13 -17
  35. data/ext/nokogiri/xml_sax_parser_context.c +8 -6
  36. data/ext/nokogiri/xml_sax_push_parser.c +7 -6
  37. data/ext/nokogiri/xml_schema.c +62 -13
  38. data/ext/nokogiri/xml_syntax_error.c +18 -12
  39. data/ext/nokogiri/xml_syntax_error.h +1 -1
  40. data/ext/nokogiri/xml_text.c +4 -2
  41. data/ext/nokogiri/xml_xpath_context.c +60 -23
  42. data/ext/nokogiri/xslt_stylesheet.c +14 -3
  43. data/lib/nokogiri.rb +17 -0
  44. data/lib/nokogiri/1.8/nokogiri.so +0 -0
  45. data/lib/nokogiri/1.9/nokogiri.so +0 -0
  46. data/lib/nokogiri/css/generated_parser.rb +72 -62
  47. data/lib/nokogiri/css/generated_tokenizer.rb +23 -23
  48. data/lib/nokogiri/css/parser.y +3 -1
  49. data/lib/nokogiri/css/tokenizer.rex +3 -3
  50. data/lib/nokogiri/css/xpath_visitor.rb +8 -3
  51. data/lib/nokogiri/ffi/html/sax/parser_context.rb +3 -3
  52. data/lib/nokogiri/ffi/libxml.rb +16 -2
  53. data/lib/nokogiri/ffi/structs/common_node.rb +15 -3
  54. data/lib/nokogiri/ffi/structs/xml_document.rb +13 -4
  55. data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +3 -2
  56. data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
  57. data/lib/nokogiri/ffi/xml/document.rb +27 -0
  58. data/lib/nokogiri/ffi/xml/entity_decl.rb +9 -0
  59. data/lib/nokogiri/ffi/xml/node.rb +142 -61
  60. data/lib/nokogiri/ffi/xml/node_set.rb +15 -12
  61. data/lib/nokogiri/ffi/xml/reader.rb +5 -0
  62. data/lib/nokogiri/ffi/xml/schema.rb +17 -0
  63. data/lib/nokogiri/ffi/xml/syntax_error.rb +4 -4
  64. data/lib/nokogiri/ffi/xml/xpath.rb +0 -10
  65. data/lib/nokogiri/ffi/xml/xpath_context.rb +22 -9
  66. data/lib/nokogiri/ffi/xslt/stylesheet.rb +3 -0
  67. data/lib/nokogiri/html/document.rb +5 -3
  68. data/lib/nokogiri/html/document_fragment.rb +28 -7
  69. data/lib/nokogiri/version.rb +6 -2
  70. data/lib/nokogiri/version_warning.rb +6 -3
  71. data/lib/nokogiri/xml.rb +1 -1
  72. data/lib/nokogiri/xml/builder.rb +35 -22
  73. data/lib/nokogiri/xml/document.rb +44 -12
  74. data/lib/nokogiri/xml/document_fragment.rb +16 -12
  75. data/lib/nokogiri/xml/entity_decl.rb +4 -0
  76. data/lib/nokogiri/xml/node.rb +152 -95
  77. data/lib/nokogiri/xml/node_set.rb +2 -1
  78. data/lib/nokogiri/xml/sax/push_parser.rb +1 -1
  79. data/lib/nokogiri/xml/schema.rb +1 -5
  80. data/lib/nokogiri/xml/syntax_error.rb +4 -0
  81. data/lib/nokogiri/xml/text.rb +9 -0
  82. data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
  83. data/tasks/cross_compile.rb +158 -0
  84. data/tasks/test.rb +0 -6
  85. data/test/css/test_xpath_visitor.rb +9 -0
  86. data/test/helper.rb +49 -11
  87. data/test/html/sax/test_parser.rb +11 -1
  88. data/test/html/test_document.rb +8 -0
  89. data/test/html/test_document_fragment.rb +14 -2
  90. data/test/html/test_element_description.rb +5 -1
  91. data/test/html/test_node.rb +5 -66
  92. data/test/test_reader.rb +28 -0
  93. data/test/test_xslt_transforms.rb +14 -0
  94. data/test/xml/test_builder.rb +43 -0
  95. data/test/xml/test_cdata.rb +12 -0
  96. data/test/xml/test_document.rb +74 -39
  97. data/test/xml/test_document_fragment.rb +36 -0
  98. data/test/xml/test_entity_decl.rb +37 -0
  99. data/test/xml/test_node.rb +192 -65
  100. data/test/xml/test_node_reparenting.rb +253 -236
  101. data/test/xml/test_node_set.rb +67 -0
  102. data/test/xml/test_text.rb +8 -0
  103. data/test/xml/test_xpath.rb +32 -0
  104. metadata +151 -79
  105. data/ext/nokogiri/iconv.dll +0 -0
  106. data/ext/nokogiri/libexslt.dll +0 -0
  107. data/ext/nokogiri/libxml2.dll +0 -0
  108. data/ext/nokogiri/libxslt.dll +0 -0
  109. data/ext/nokogiri/xml_xpath.c +0 -53
  110. data/ext/nokogiri/xml_xpath.h +0 -11
  111. data/ext/nokogiri/zlib1.dll +0 -0
  112. data/lib/nokogiri/xml/fragment_handler.rb +0 -79
@@ -7,6 +7,10 @@ module Nokogiri
7
7
  undef_method :namespace_definitions
8
8
  undef_method :line
9
9
 
10
+ def self.new name, doc, *args
11
+ doc.create_entity(name, *args)
12
+ end
13
+
10
14
  def inspect
11
15
  "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{to_s.inspect}>"
12
16
  end
@@ -35,6 +35,7 @@ module Nokogiri
35
35
  # You may search this node's subtree using Node#xpath and Node#css
36
36
  class Node
37
37
  include Nokogiri::XML::PP::Node
38
+ include Enumerable
38
39
 
39
40
  # Element node type, see Nokogiri::XML::Node#element?
40
41
  ELEMENT_NODE = 1
@@ -79,7 +80,7 @@ module Nokogiri
79
80
  # DOCB document node type
80
81
  DOCB_DOCUMENT_NODE = 21
81
82
 
82
- def initialize name, document
83
+ def initialize name, document # :nodoc:
83
84
  # ... Ya. This is empty on purpose.
84
85
  end
85
86
 
@@ -139,15 +140,11 @@ module Nokogiri
139
140
  sets = paths.map { |path|
140
141
  ctx = XPathContext.new(self)
141
142
  ctx.register_namespaces(ns)
142
- set = ctx.evaluate(path, handler).node_set
143
- set.document = document
144
- document.decorate(set)
145
- set
143
+ ctx.evaluate(path, handler)
146
144
  }
147
145
  return sets.first if sets.length == 1
148
146
 
149
147
  NodeSet.new(document) do |combined|
150
- document.decorate(combined)
151
148
  sets.each do |set|
152
149
  set.each do |node|
153
150
  combined << node
@@ -193,7 +190,7 @@ module Nokogiri
193
190
  end
194
191
 
195
192
  ###
196
- # Search this node's immidiate children using CSS selector +selector+
193
+ # Search this node's immediate children using CSS selector +selector+
197
194
  def > selector
198
195
  ns = document.root.namespaces
199
196
  xpath CSS.xpath_for(selector, :prefix => "./", :ns => ns).first
@@ -201,6 +198,7 @@ module Nokogiri
201
198
 
202
199
  ###
203
200
  # Search for the first occurrence of +path+.
201
+ #
204
202
  # Returns nil if nothing is found, otherwise a Node.
205
203
  def at path, ns = document.root ? document.root.namespaces : {}
206
204
  search(path, ns).first
@@ -233,46 +231,124 @@ module Nokogiri
233
231
  end
234
232
 
235
233
  ###
236
- # Add +node+ as a child of this Node.
237
- # The new node must be a Nokogiri::XML::Node or a non-empty String.
234
+ # Add +node_or_tags+ as a child of this Node.
235
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
236
+ #
238
237
  # Returns the new child node.
239
- def add_child(node)
240
- Node.verify_nodeishness(node)
241
- if node.type == DOCUMENT_FRAG_NODE
242
- node.children.each do |child|
243
- add_child_node child
244
- end
238
+ def add_child node_or_tags
239
+ node_or_tags = coerce(node_or_tags)
240
+ if node_or_tags.is_a?(XML::NodeSet)
241
+ node_or_tags.each { |n| add_child_node n }
245
242
  else
246
- add_child_node node
243
+ add_child_node node_or_tags
247
244
  end
248
245
  end
249
246
 
250
247
  ###
251
- # Insert +node+ before this Node (as a sibling).
252
- def add_previous_sibling(node)
253
- Node.verify_nodeishness(node)
254
- if node.type == DOCUMENT_FRAG_NODE
255
- node.children.each do |child|
256
- add_previous_sibling_node child
257
- end
248
+ # Insert +node_or_tags+ before this Node (as a sibling).
249
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
250
+ #
251
+ # Returns the new sibling node.
252
+ #
253
+ # Also see related method +before+.
254
+ def add_previous_sibling node_or_tags
255
+ node_or_tags = coerce(node_or_tags)
256
+ if node_or_tags.is_a?(XML::NodeSet)
257
+ node_or_tags.each { |n| add_previous_sibling_node n }
258
258
  else
259
- add_previous_sibling_node node
259
+ add_previous_sibling_node node_or_tags
260
260
  end
261
261
  end
262
262
 
263
263
  ###
264
- # Insert +node+ after this Node (as a sibling).
265
- def add_next_sibling(node)
266
- Node.verify_nodeishness(node)
267
- if node.type == DOCUMENT_FRAG_NODE
268
- node.children.reverse.each do |child|
269
- add_next_sibling_node child
264
+ # Insert +node_or_tags+ after this Node (as a sibling).
265
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
266
+ #
267
+ # Returns the new sibling node.
268
+ #
269
+ # Also see related method +after+.
270
+ def add_next_sibling node_or_tags
271
+ node_or_tags = coerce(node_or_tags)
272
+ if node_or_tags.is_a?(XML::NodeSet)
273
+ if '1.8.6' == RUBY_VERSION
274
+ node_or_tags.reverse.each { |n| add_next_sibling_node n }
275
+ else
276
+ node_or_tags.reverse_each { |n| add_next_sibling_node n }
270
277
  end
271
278
  else
272
- add_next_sibling_node node
279
+ add_next_sibling_node node_or_tags
280
+ end
281
+ end
282
+
283
+ ####
284
+ # Insert +node_or_tags+ before this node (as a sibling).
285
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
286
+ #
287
+ # Returns self, to support chaining of calls.
288
+ #
289
+ # Also see related method +add_previous_sibling+.
290
+ def before node_or_tags
291
+ add_previous_sibling node_or_tags
292
+ self
293
+ end
294
+
295
+ ####
296
+ # Insert +node_or_tags+ after this node (as a sibling).
297
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a string containing markup.
298
+ #
299
+ # Returns self, to support chaining of calls.
300
+ #
301
+ # Also see related method +add_next_sibling+.
302
+ def after node_or_tags
303
+ add_next_sibling node_or_tags
304
+ self
305
+ end
306
+
307
+ ####
308
+ # Set the inner_html for this Node to +node_or_tags+
309
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a Nokogiri::XML::DocumentFragment, or a string containing markup.
310
+ #
311
+ # Returns self.
312
+ def inner_html= node_or_tags
313
+ node_or_tags = coerce(node_or_tags)
314
+ children.unlink
315
+ if node_or_tags.is_a?(XML::NodeSet)
316
+ node_or_tags.each { |n| add_child_node n }
317
+ else
318
+ add_child node_or_tags
319
+ end
320
+ self
321
+ end
322
+
323
+ ####
324
+ # Replace this Node with +node_or_tags+.
325
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
326
+ #
327
+ # Returns the new child node.
328
+ #
329
+ # Also see related method +swap+.
330
+ def replace node_or_tags
331
+ node_or_tags = coerce(node_or_tags)
332
+ if node_or_tags.is_a?(XML::NodeSet)
333
+ node_or_tags.each { |n| add_previous_sibling n }
334
+ unlink
335
+ else
336
+ replace_node node_or_tags
273
337
  end
274
338
  end
275
339
 
340
+ ####
341
+ # Swap this Node for +node_or_tags+
342
+ # +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup.
343
+ #
344
+ # Returns self, to support chaining of calls.
345
+ #
346
+ # Also see related method +replace+.
347
+ def swap node_or_tags
348
+ replace node_or_tags
349
+ self
350
+ end
351
+
276
352
  alias :next :next_sibling
277
353
  alias :previous :previous_sibling
278
354
 
@@ -295,6 +371,7 @@ module Nokogiri
295
371
  alias :type :node_type
296
372
  alias :to_str :text
297
373
  alias :clone :dup
374
+ alias :elements :element_children
298
375
 
299
376
  ####
300
377
  # Returns a hash containing the node's attributes. The key is
@@ -322,7 +399,7 @@ module Nokogiri
322
399
  # Iterate over each attribute name and value pair for this Node.
323
400
  def each &block
324
401
  attribute_nodes.each { |node|
325
- block.call(node.node_name, node.value)
402
+ block.call([node.node_name, node.value])
326
403
  }
327
404
  end
328
405
 
@@ -339,52 +416,35 @@ module Nokogiri
339
416
  ancestors.last.search(selector).include?(self)
340
417
  end
341
418
 
342
- ####
343
- # Create nodes from +data+ and insert them before this node
344
- # (as a sibling).
345
- def before data
346
- fragment(data).children.each do |node|
347
- add_previous_sibling node
348
- end
349
- self
419
+ ###
420
+ # Create a DocumentFragment containing +tags+ that is relative to _this_
421
+ # context node.
422
+ def fragment tags
423
+ type = document.html? ? Nokogiri::HTML : Nokogiri::XML
424
+ type::DocumentFragment.new(document, tags, self)
350
425
  end
351
426
 
352
- ####
353
- # Create nodes from +data+ and insert them after this node
354
- # (as a sibling).
355
- def after data
356
- fragment(data).children.to_a.reverse.each do |node|
357
- add_next_sibling node
427
+ ###
428
+ # Parse +string_or_io+ as a document fragment within the context of
429
+ # *this* node. Returns a XML::NodeSet containing the nodes parsed from
430
+ # +string_or_io+.
431
+ def parse string_or_io, options = ParseOptions::DEFAULT_XML
432
+ if Fixnum === options
433
+ options = Nokogiri::XML::ParseOptions.new(options)
358
434
  end
359
- self
360
- end
435
+ # Give the options to the user
436
+ yield options if block_given?
361
437
 
362
- ####
363
- # Swap this Node for new nodes made from +data+
364
- def swap data
365
- before(data)
366
- remove
367
- self
368
- end
369
-
370
- ####
371
- # Set the inner_html for this Node to +tags+
372
- def inner_html= tags
373
- children.each { |x| x.remove}
438
+ contents = string_or_io.respond_to?(:read) ?
439
+ string_or_io.read :
440
+ string_or_io
374
441
 
375
- fragment(tags).children.to_a.each do |node|
376
- add_child node
377
- end
378
- self
379
- end
380
-
381
- def fragment tags # :nodoc:
382
- # TODO: deprecate?
383
- document.fragment(tags)
442
+ return Nokogiri::XML::NodeSet.new(document) if contents.empty?
443
+ in_context(contents, options.to_i)
384
444
  end
385
445
 
386
446
  ####
387
- # Set the Node content to +string+. The content gets XML escaped.
447
+ # Set the Node's content to a Text node containing +string+. The string gets XML escaped, not interpreted as markup.
388
448
  def content= string
389
449
  self.native_content = encode_special_chars(string.to_s)
390
450
  end
@@ -399,7 +459,7 @@ module Nokogiri
399
459
  ###
400
460
  # Get a hash containing the Namespace definitions for this Node
401
461
  def namespaces
402
- Hash[*namespace_definitions.map { |nd|
462
+ Hash[*namespace_scopes.map { |nd|
403
463
  key = ['xmlns', nd.prefix].compact.join(':')
404
464
  if RUBY_VERSION >= '1.9' && document.encoding
405
465
  begin
@@ -436,6 +496,11 @@ module Nokogiri
436
496
  type == TEXT_NODE
437
497
  end
438
498
 
499
+ # Returns true if this is a DocumentFragment
500
+ def fragment?
501
+ type == DOCUMENT_FRAG_NODE
502
+ end
503
+
439
504
  ###
440
505
  # Fetch the Nokogiri::HTML::ElementDescription for this node. Returns
441
506
  # nil on XML documents and on unknown tags.
@@ -509,12 +574,15 @@ module Nokogiri
509
574
  ###
510
575
  # Set the namespace for this node to +ns+
511
576
  def namespace= ns
577
+ return set_namespace(ns) unless ns
578
+
579
+ unless Nokogiri::XML::Namespace === ns
580
+ raise TypeError, "#{ns.class} can't be coerced into Nokogiri::XML::Namespace"
581
+ end
512
582
  if ns.document != document
513
583
  raise ArgumentError, 'namespace must be declared on the same document'
514
584
  end
515
- unless ns.is_a? Nokogiri::XML::Namespace
516
- raise TypeError, "#{ns.class} can't be coerced into Nokogiri::XML::Namespace"
517
- end
585
+
518
586
  set_namespace ns
519
587
  end
520
588
 
@@ -531,22 +599,6 @@ module Nokogiri
531
599
  visitor.visit(self)
532
600
  end
533
601
 
534
- ####
535
- # +replace+ this Node with the +node+ in the Document.
536
- # The new node must be a Nokogiri::XML::Node or a non-empty String.
537
- # Returns the new child node.
538
- def replace node
539
- Node.verify_nodeishness(node)
540
- if node.type == DOCUMENT_FRAG_NODE
541
- node.children.each do |child|
542
- add_previous_sibling child
543
- end
544
- unlink
545
- else
546
- replace_node node
547
- end
548
- end
549
-
550
602
  ###
551
603
  # Test to see if this Node is equal to +other+
552
604
  def == other
@@ -612,8 +664,6 @@ module Nokogiri
612
664
  #
613
665
  # See Node#write_to for a list of +options+
614
666
  def to_xml options = {}
615
- encoding = nil
616
-
617
667
  options[:save_with] ||= SaveOptions::FORMAT | SaveOptions::AS_XML
618
668
 
619
669
  serialize(options)
@@ -719,13 +769,20 @@ module Nokogiri
719
769
  end
720
770
 
721
771
  private
722
- def self.verify_nodeishness(node)
723
- if node.is_a?(Document) || !node.is_a?(XML::Node)
772
+
773
+ def coerce(data) # :nodoc:
774
+ return data if data.is_a?(XML::NodeSet)
775
+ return data.children if data.is_a?(XML::DocumentFragment)
776
+ return fragment(data).children if data.is_a?(String)
777
+
778
+ if data.is_a?(Document) || !data.is_a?(XML::Node)
724
779
  raise ArgumentError, <<-EOERR
725
- Node.replace requires a Node argument, and cannot accept a Document.
780
+ Requires a Node, NodeSet or String argument, and cannot accept a #{data.class}.
726
781
  (You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)
727
782
  EOERR
728
783
  end
784
+
785
+ data
729
786
  end
730
787
 
731
788
  def inspect_attributes
@@ -13,6 +13,7 @@ module Nokogiri
13
13
  # Create a NodeSet with +document+ defaulting to +list+
14
14
  def initialize document, list = []
15
15
  @document = document
16
+ document.decorate(self)
16
17
  list.each { |x| self << x }
17
18
  yield self if block_given?
18
19
  end
@@ -231,7 +232,7 @@ module Nokogiri
231
232
  # Wrap this NodeSet with +html+ or the results of the builder in +blk+
232
233
  def wrap(html, &blk)
233
234
  each do |j|
234
- new_parent = Nokogiri.make(html, &blk)
235
+ new_parent = document.root.parse(html).first
235
236
  j.add_next_sibling(new_parent)
236
237
  new_parent.add_child(j)
237
238
  end
@@ -42,7 +42,7 @@ module Nokogiri
42
42
 
43
43
  ###
44
44
  # Write a +chunk+ of XML to the PushParser. Any callback methods
45
- # that can be called will be called immidiately.
45
+ # that can be called will be called immediately.
46
46
  def write chunk, last_chunk = false
47
47
  native_write(chunk, last_chunk)
48
48
  end
@@ -43,11 +43,7 @@ module Nokogiri
43
43
  # Nokogiri::XML::SyntaxError objects found while validating the
44
44
  # +thing+ is returned.
45
45
  def validate thing
46
- return validate_document(thing) if thing.is_a?(Nokogiri::XML::Document)
47
-
48
- # FIXME libxml2 has an api for validating files. We should switch
49
- # to that because it will probably save memory.
50
- validate_document(Nokogiri::XML(File.read(thing)))
46
+ thing.is_a?(Nokogiri::XML::Document) ? validate_document(thing) : validate_file(thing)
51
47
  end
52
48
 
53
49
  ###
@@ -38,6 +38,10 @@ module Nokogiri
38
38
  def fatal?
39
39
  level == 3
40
40
  end
41
+
42
+ def to_s
43
+ super.chomp
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -0,0 +1,9 @@
1
+ module Nokogiri
2
+ module XML
3
+ class Text < Nokogiri::XML::CharacterData
4
+ def content=(string)
5
+ self.native_content = string.to_s
6
+ end
7
+ end
8
+ end
9
+ end