libxml-ruby 2.2.2-x86-mingw32 → 2.3.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/HISTORY +14 -2
  2. data/MANIFEST +1 -0
  3. data/README.rdoc +2 -2
  4. data/ext/libxml/ruby_xml_document.c +191 -29
  5. data/ext/libxml/ruby_xml_document.h +1 -0
  6. data/ext/libxml/ruby_xml_encoding.c +21 -7
  7. data/ext/libxml/ruby_xml_encoding.h +1 -0
  8. data/ext/libxml/ruby_xml_node.c +38 -0
  9. data/ext/libxml/ruby_xml_sax2_handler.c +30 -34
  10. data/ext/libxml/ruby_xml_sax_parser.c +0 -14
  11. data/ext/libxml/ruby_xml_version.h +4 -4
  12. data/lib/1.8/libxml_ruby.so +0 -0
  13. data/lib/1.9/libxml_ruby.so +0 -0
  14. data/lib/libxml/document.rb +18 -16
  15. data/libxml-ruby.gemspec +3 -2
  16. data/test/c14n/given/doc.dtd +1 -0
  17. data/test/c14n/given/example-1.xml +14 -0
  18. data/test/c14n/given/example-2.xml +11 -0
  19. data/test/c14n/given/example-3.xml +18 -0
  20. data/test/c14n/given/example-4.xml +9 -0
  21. data/test/c14n/given/example-5.xml +12 -0
  22. data/test/c14n/given/example-6.xml +2 -0
  23. data/test/c14n/given/example-7.xml +11 -0
  24. data/test/c14n/given/example-8.xml +11 -0
  25. data/test/c14n/given/example-8.xpath +10 -0
  26. data/test/c14n/given/world.txt +1 -0
  27. data/test/c14n/result/1-1-without-comments/example-1 +4 -0
  28. data/test/c14n/result/1-1-without-comments/example-2 +11 -0
  29. data/test/c14n/result/1-1-without-comments/example-3 +14 -0
  30. data/test/c14n/result/1-1-without-comments/example-4 +9 -0
  31. data/test/c14n/result/1-1-without-comments/example-5 +3 -0
  32. data/test/c14n/result/1-1-without-comments/example-6 +1 -0
  33. data/test/c14n/result/1-1-without-comments/example-7 +1 -0
  34. data/test/c14n/result/1-1-without-comments/example-8 +1 -0
  35. data/test/c14n/result/with-comments/example-1 +6 -0
  36. data/test/c14n/result/with-comments/example-2 +11 -0
  37. data/test/c14n/result/with-comments/example-3 +14 -0
  38. data/test/c14n/result/with-comments/example-4 +9 -0
  39. data/test/c14n/result/with-comments/example-5 +4 -0
  40. data/test/c14n/result/with-comments/example-6 +1 -0
  41. data/test/c14n/result/with-comments/example-7 +1 -0
  42. data/test/c14n/result/without-comments/example-1 +4 -0
  43. data/test/c14n/result/without-comments/example-2 +11 -0
  44. data/test/c14n/result/without-comments/example-3 +14 -0
  45. data/test/c14n/result/without-comments/example-4 +9 -0
  46. data/test/c14n/result/without-comments/example-5 +3 -0
  47. data/test/c14n/result/without-comments/example-6 +1 -0
  48. data/test/c14n/result/without-comments/example-7 +1 -0
  49. data/test/tc_canonicalize.rb +125 -0
  50. data/test/tc_document.rb +2 -18
  51. data/test/tc_encoding.rb +7 -5
  52. data/test/tc_encoding_sax.rb +115 -0
  53. data/test/tc_node_pi.rb +40 -0
  54. data/test/tc_xpath.rb +23 -0
  55. data/test/test_suite.rb +7 -1
  56. metadata +45 -6
  57. data/test/new_main.rb +0 -29
@@ -0,0 +1,40 @@
1
+ # encoding: UTF-8
2
+
3
+ require './test_helper'
4
+
5
+ require 'test/unit'
6
+
7
+ class NodeCommentTest < Test::Unit::TestCase
8
+ def setup
9
+ xp = XML::Parser.string('<root></root>')
10
+ @doc = xp.parse
11
+ assert_instance_of(XML::Document, @doc)
12
+ @root = @doc.root
13
+ end
14
+
15
+ def test_libxml_node_add_pi_01
16
+ @root << XML::Node.new_pi('mypi')
17
+ assert_equal '<root><?mypi?></root>',
18
+ @root.to_s.gsub(/\n\s*/,'')
19
+ end
20
+
21
+ def test_libxml_node_add_pi_02
22
+ @root << XML::Node.new_pi('mypi')
23
+ assert_equal 'pi',
24
+ @root.child.node_type_name
25
+ end
26
+
27
+ def test_libxml_node_add_pi_03
28
+ @root << el = XML::Node.new_pi('mypi')
29
+ el << "_this_is_added"
30
+ assert_equal '<root><?mypi _this_is_added?></root>',
31
+ @root.to_s.gsub(/\n\s*/,'')
32
+ end
33
+
34
+ def test_libxml_node_add_pi_04
35
+ @root << XML::Node.new_pi('mypi','mycontent')
36
+ assert_equal '<root><?mypi mycontent?></root>',
37
+ @root.to_s.gsub(/\n\s*/,'')
38
+ end
39
+
40
+ end
data/test/tc_xpath.rb CHANGED
@@ -207,4 +207,27 @@ class TestXPath < Test::Unit::TestCase
207
207
  end
208
208
  assert_equal("Error: Invalid expression.", error.to_s)
209
209
  end
210
+
211
+ def test_find_cdata
212
+ doc = LibXML::XML::Document.string('<root>hi there <![CDATA[ mycdata ]]> bye!</root>')
213
+
214
+ nodes = doc.find('/root/text()')
215
+ assert_equal(3, nodes.length)
216
+ assert_equal(nodes[0].node_type, LibXML::XML::Node::TEXT_NODE)
217
+ assert_equal(nodes[0].content, 'hi there ')
218
+
219
+ assert_equal(nodes[1].node_type, LibXML::XML::Node::CDATA_SECTION_NODE)
220
+ assert_equal(nodes[1].content, ' mycdata ')
221
+
222
+ assert_equal(nodes[2].node_type, LibXML::XML::Node::TEXT_NODE)
223
+ assert_equal(nodes[2].content, ' bye!')
224
+ end
225
+
226
+ def test_find_comment
227
+ doc = LibXML::XML::Document.string('<root>hi there <!-- my comment --> bye!</root>')
228
+
229
+ nodes = doc.find('//comment()')
230
+ assert_equal(1, nodes.length)
231
+ assert_equal(nodes[0].content, ' my comment ')
232
+ end
210
233
  end
data/test/test_suite.rb CHANGED
@@ -8,10 +8,10 @@ Dir.chdir(dir)
8
8
  require './tc_attr'
9
9
  require './tc_attr_decl'
10
10
  require './tc_attributes'
11
+ require './tc_canonicalize'
11
12
  require './tc_document'
12
13
  require './tc_document_write'
13
14
  require './tc_dtd'
14
- require './tc_encoding'
15
15
  require './tc_error'
16
16
  require './tc_html_parser'
17
17
  require './tc_html_parser_context'
@@ -22,6 +22,7 @@ require './tc_node_cdata'
22
22
  require './tc_node_comment'
23
23
  require './tc_node_copy'
24
24
  require './tc_node_edit'
25
+ require './tc_node_pi'
25
26
  require './tc_node_text'
26
27
  require './tc_node_write'
27
28
  require './tc_node_xlink'
@@ -38,6 +39,11 @@ require './tc_xpath_context'
38
39
  require './tc_xpath_expression'
39
40
  require './tc_xpointer'
40
41
 
42
+
43
+ if defined?(Encoding)
44
+ require './tc_encoding'
45
+ require './tc_encoding_sax'
46
+ end
41
47
  # Compatibility
42
48
  require './tc_properties'
43
49
  require './tc_deprecated_require'
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 2
9
- - 2
10
- version: 2.2.2
8
+ - 3
9
+ - 0
10
+ version: 2.3.0
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Ross Bamform
@@ -16,11 +16,12 @@ authors:
16
16
  - Dan Janwoski
17
17
  - Anurag Priyam
18
18
  - Charlie Savage
19
+ - Ryan Johnson
19
20
  autorequire:
20
21
  bindir: bin
21
22
  cert_chain: []
22
23
 
23
- date: 2011-08-29 00:00:00 Z
24
+ date: 2012-03-18 00:00:00 Z
24
25
  dependencies: []
25
26
 
26
27
  description: " The Libxml-Ruby project provides Ruby language bindings for the GNOME\n Libxml2 XML toolkit. It is free software, released under the MIT License.\n Libxml-ruby's primary advantage over REXML is performance - if speed\n is your need, these are good libraries to consider, as demonstrated\n by the informal benchmark below.\n"
@@ -134,6 +135,39 @@ files:
134
135
  - script/benchmark/sock_entries.xml
135
136
  - script/benchmark/throughput
136
137
  - script/test
138
+ - test/c14n/given/doc.dtd
139
+ - test/c14n/given/example-1.xml
140
+ - test/c14n/given/example-2.xml
141
+ - test/c14n/given/example-3.xml
142
+ - test/c14n/given/example-4.xml
143
+ - test/c14n/given/example-5.xml
144
+ - test/c14n/given/example-6.xml
145
+ - test/c14n/given/example-7.xml
146
+ - test/c14n/given/example-8.xml
147
+ - test/c14n/given/example-8.xpath
148
+ - test/c14n/given/world.txt
149
+ - test/c14n/result/1-1-without-comments/example-1
150
+ - test/c14n/result/1-1-without-comments/example-2
151
+ - test/c14n/result/1-1-without-comments/example-3
152
+ - test/c14n/result/1-1-without-comments/example-4
153
+ - test/c14n/result/1-1-without-comments/example-5
154
+ - test/c14n/result/1-1-without-comments/example-6
155
+ - test/c14n/result/1-1-without-comments/example-7
156
+ - test/c14n/result/1-1-without-comments/example-8
157
+ - test/c14n/result/with-comments/example-1
158
+ - test/c14n/result/with-comments/example-2
159
+ - test/c14n/result/with-comments/example-3
160
+ - test/c14n/result/with-comments/example-4
161
+ - test/c14n/result/with-comments/example-5
162
+ - test/c14n/result/with-comments/example-6
163
+ - test/c14n/result/with-comments/example-7
164
+ - test/c14n/result/without-comments/example-1
165
+ - test/c14n/result/without-comments/example-2
166
+ - test/c14n/result/without-comments/example-3
167
+ - test/c14n/result/without-comments/example-4
168
+ - test/c14n/result/without-comments/example-5
169
+ - test/c14n/result/without-comments/example-6
170
+ - test/c14n/result/without-comments/example-7
137
171
  - test/etc_doc_to_s.rb
138
172
  - test/ets_doc_file.rb
139
173
  - test/ets_doc_to_s.rb
@@ -157,15 +191,16 @@ files:
157
191
  - test/model/shiporder.xsd
158
192
  - test/model/soap.xml
159
193
  - test/model/xinclude.xml
160
- - test/new_main.rb
161
194
  - test/tc_attr.rb
162
195
  - test/tc_attributes.rb
163
196
  - test/tc_attr_decl.rb
197
+ - test/tc_canonicalize.rb
164
198
  - test/tc_deprecated_require.rb
165
199
  - test/tc_document.rb
166
200
  - test/tc_document_write.rb
167
201
  - test/tc_dtd.rb
168
202
  - test/tc_encoding.rb
203
+ - test/tc_encoding_sax.rb
169
204
  - test/tc_error.rb
170
205
  - test/tc_gc.rb
171
206
  - test/tc_html_parser.rb
@@ -177,6 +212,7 @@ files:
177
212
  - test/tc_node_comment.rb
178
213
  - test/tc_node_copy.rb
179
214
  - test/tc_node_edit.rb
215
+ - test/tc_node_pi.rb
180
216
  - test/tc_node_text.rb
181
217
  - test/tc_node_write.rb
182
218
  - test/tc_node_xlink.rb
@@ -232,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
268
  requirements: []
233
269
 
234
270
  rubyforge_project:
235
- rubygems_version: 1.7.2
271
+ rubygems_version: 1.8.10
236
272
  signing_key:
237
273
  specification_version: 3
238
274
  summary: Ruby Bindings for LibXML2
@@ -240,11 +276,13 @@ test_files:
240
276
  - test/tc_attr.rb
241
277
  - test/tc_attributes.rb
242
278
  - test/tc_attr_decl.rb
279
+ - test/tc_canonicalize.rb
243
280
  - test/tc_deprecated_require.rb
244
281
  - test/tc_document.rb
245
282
  - test/tc_document_write.rb
246
283
  - test/tc_dtd.rb
247
284
  - test/tc_encoding.rb
285
+ - test/tc_encoding_sax.rb
248
286
  - test/tc_error.rb
249
287
  - test/tc_gc.rb
250
288
  - test/tc_html_parser.rb
@@ -256,6 +294,7 @@ test_files:
256
294
  - test/tc_node_comment.rb
257
295
  - test/tc_node_copy.rb
258
296
  - test/tc_node_edit.rb
297
+ - test/tc_node_pi.rb
259
298
  - test/tc_node_text.rb
260
299
  - test/tc_node_write.rb
261
300
  - test/tc_node_xlink.rb
data/test/new_main.rb DELETED
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- string1 = "(ISC)²"
4
- puts string1.encoding
5
- puts string1.bytes.to_a.join(' ')
6
- puts string1
7
-
8
- puts ""
9
- string2 = string1.encode('iso-8859-1')
10
- puts string2.encoding
11
- puts string2.bytes.to_a.join(' ')
12
- puts string2
13
-
14
- puts ""
15
- string3 = string1.force_encoding('iso-8859-1').encode('utf-8')
16
- puts string3.encoding
17
- puts string3.bytes.to_a.join(' ')
18
- puts string3
19
-
20
- #UTF-8
21
- #40 73 83 67 41 194 178
22
- #(ISC)²
23
- #
24
- #ISO-8859-1
25
- #40 73 83 67 41 178
26
- #(ISC)²
27
-
28
-
29
- #40 73 83 67 41 195 130 194 178