nokogiri 1.3.1 → 1.3.2

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 (62) hide show
  1. data/CHANGELOG.ja.rdoc +25 -0
  2. data/CHANGELOG.rdoc +23 -0
  3. data/Manifest.txt +5 -0
  4. data/README.ja.rdoc +5 -5
  5. data/README.rdoc +3 -3
  6. data/Rakefile +27 -23
  7. data/ext/nokogiri/extconf.rb +54 -12
  8. data/ext/nokogiri/xml_document.c +4 -1
  9. data/ext/nokogiri/xml_document.h +2 -0
  10. data/ext/nokogiri/xml_dtd.c +29 -0
  11. data/ext/nokogiri/xml_node.c +9 -1
  12. data/ext/nokogiri/xml_node_set.c +5 -1
  13. data/ext/nokogiri/xml_relax_ng.c +50 -3
  14. data/ext/nokogiri/xml_sax_parser.c +84 -77
  15. data/ext/nokogiri/xml_schema.c +52 -3
  16. data/ext/nokogiri/xml_syntax_error.c +7 -0
  17. data/ext/nokogiri/xml_syntax_error.h +1 -0
  18. data/lib/nokogiri.rb +2 -2
  19. data/lib/nokogiri/css/parser.rb +2 -2
  20. data/lib/nokogiri/ffi/io_callbacks.rb +20 -12
  21. data/lib/nokogiri/ffi/libxml.rb +8 -0
  22. data/lib/nokogiri/ffi/xml/document.rb +1 -1
  23. data/lib/nokogiri/ffi/xml/dtd.rb +22 -6
  24. data/lib/nokogiri/ffi/xml/namespace.rb +9 -7
  25. data/lib/nokogiri/ffi/xml/node.rb +4 -0
  26. data/lib/nokogiri/ffi/xml/node_set.rb +4 -1
  27. data/lib/nokogiri/ffi/xml/relax_ng.rb +35 -3
  28. data/lib/nokogiri/ffi/xml/sax/parser.rb +20 -19
  29. data/lib/nokogiri/ffi/xml/schema.rb +41 -4
  30. data/lib/nokogiri/html.rb +2 -2
  31. data/lib/nokogiri/html/document.rb +3 -3
  32. data/lib/nokogiri/version.rb +2 -2
  33. data/lib/nokogiri/xml.rb +3 -3
  34. data/lib/nokogiri/xml/document.rb +14 -4
  35. data/lib/nokogiri/xml/fragment_handler.rb +8 -0
  36. data/lib/nokogiri/xml/node.rb +1 -104
  37. data/lib/nokogiri/xml/node_set.rb +46 -6
  38. data/lib/nokogiri/xml/parse_options.rb +7 -2
  39. data/lib/nokogiri/xml/relax_ng.rb +2 -2
  40. data/lib/nokogiri/xml/sax.rb +1 -0
  41. data/lib/nokogiri/xml/sax/document.rb +4 -4
  42. data/lib/nokogiri/xml/sax/legacy_handlers.rb +65 -0
  43. data/lib/nokogiri/xml/sax/parser.rb +7 -0
  44. data/lib/nokogiri/xml/sax/push_parser.rb +3 -0
  45. data/lib/nokogiri/xml/schema.rb +1 -5
  46. data/lib/xsd/xmlparser/nokogiri.rb +14 -7
  47. data/tasks/test.rb +1 -62
  48. data/test/files/bar/bar.xsd +4 -0
  49. data/test/files/foo/foo.xsd +4 -0
  50. data/test/files/snuggles.xml +3 -0
  51. data/test/files/valid_bar.xml +2 -0
  52. data/test/helper.rb +9 -8
  53. data/test/html/test_document_fragment.rb +14 -0
  54. data/test/test_reader.rb +10 -10
  55. data/test/xml/sax/test_parser.rb +77 -0
  56. data/test/xml/sax/test_push_parser.rb +11 -7
  57. data/test/xml/test_document.rb +25 -0
  58. data/test/xml/test_dtd.rb +6 -1
  59. data/test/xml/test_node.rb +7 -0
  60. data/test/xml/test_node_set.rb +19 -0
  61. data/test/xml/test_schema.rb +24 -0
  62. metadata +10 -5
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
2
2
 
3
3
  module Nokogiri
4
- module HTML
4
+ module XML
5
5
  class TestDTD < Nokogiri::TestCase
6
6
  def setup
7
7
  super
@@ -9,6 +9,11 @@ module Nokogiri
9
9
  assert @dtd = @xml.internal_subset
10
10
  end
11
11
 
12
+ def test_validate
13
+ list = @xml.internal_subset.validate @xml
14
+ assert_equal 44, list.length
15
+ end
16
+
12
17
  def test_external_subsets
13
18
  assert subset = @xml.internal_subset
14
19
  assert_equal 'staff', subset.name
@@ -157,6 +157,13 @@ module Nokogiri
157
157
  assert_equal 'http://tenderlovemaking.com', node.namespaces['xmlns:foo']
158
158
  end
159
159
 
160
+ def test_add_namespace_twice
161
+ node = @xml.at('address')
162
+ ns = node.add_namespace('foo', 'http://tenderlovemaking.com')
163
+ ns2 = node.add_namespace('foo', 'http://tenderlovemaking.com')
164
+ assert_equal ns, ns2
165
+ end
166
+
160
167
  def test_add_default_ns
161
168
  node = @xml.at('address')
162
169
  node.add_namespace(nil, 'http://tenderlovemaking.com')
@@ -8,6 +8,25 @@ module Nokogiri
8
8
  @xml = Nokogiri::XML(File.read(XML_FILE), XML_FILE)
9
9
  end
10
10
 
11
+ def test_search_empty_node_set
12
+ set = Nokogiri::XML::NodeSet.new(Nokogiri::XML::Document.new)
13
+ assert_equal 0, set.css('foo').length
14
+ assert_equal 0, set.xpath('.//foo').length
15
+ assert_equal 0, set.search('foo').length
16
+ end
17
+
18
+ def test_css_searches_match_self
19
+ html = Nokogiri::HTML("<html><body><div class='a'></div></body></html>")
20
+ set = html.xpath("/html/body/div")
21
+ assert_equal set.first, set.css(".a").first
22
+ end
23
+
24
+ def test_search_with_css_matches_self
25
+ html = Nokogiri::HTML("<html><body><div class='a'></div></body></html>")
26
+ set = html.xpath("/html/body/div")
27
+ assert_equal set.first, set.search(".a").first
28
+ end
29
+
11
30
  def test_double_equal
12
31
  assert node_set_one = @xml.xpath('//employee')
13
32
  assert node_set_two = @xml.xpath('//employee')
@@ -7,6 +7,30 @@ module Nokogiri
7
7
  assert @xsd = Nokogiri::XML::Schema(File.read(PO_SCHEMA_FILE))
8
8
  end
9
9
 
10
+ def test_schema_from_document
11
+ doc = Nokogiri::XML(File.open(PO_SCHEMA_FILE))
12
+ assert doc
13
+ xsd = Nokogiri::XML::Schema.from_document doc
14
+ assert_instance_of Nokogiri::XML::Schema, xsd
15
+ end
16
+
17
+ def test_schema_from_document_node
18
+ doc = Nokogiri::XML(File.open(PO_SCHEMA_FILE))
19
+ assert doc
20
+ xsd = Nokogiri::XML::Schema.from_document doc.root
21
+ assert_instance_of Nokogiri::XML::Schema, xsd
22
+ end
23
+
24
+ def test_schema_validates_with_relative_paths
25
+ xsd = File.join(ASSETS_DIR, 'foo', 'foo.xsd')
26
+ xml = File.join(ASSETS_DIR, 'valid_bar.xml')
27
+ doc = Nokogiri::XML(File.open(xsd))
28
+ xsd = Nokogiri::XML::Schema.from_document doc
29
+
30
+ doc = Nokogiri::XML(File.open(xml))
31
+ assert xsd.valid?(doc)
32
+ end
33
+
10
34
  def test_parse_with_memory
11
35
  assert_instance_of Nokogiri::XML::Schema, @xsd
12
36
  assert_equal 0, @xsd.errors.length
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-06-07 00:00:00 -07:00
13
+ date: 2009-06-22 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -51,7 +51,7 @@ dependencies:
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.12.2
54
+ version: 2.2.0
55
55
  version:
56
56
  description: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's\n\
57
57
  many features is the ability to search documents via XPath or CSS3 selectors.\n\n\
@@ -232,6 +232,7 @@ files:
232
232
  - lib/nokogiri/xml/relax_ng.rb
233
233
  - lib/nokogiri/xml/sax.rb
234
234
  - lib/nokogiri/xml/sax/document.rb
235
+ - lib/nokogiri/xml/sax/legacy_handlers.rb
235
236
  - lib/nokogiri/xml/sax/parser.rb
236
237
  - lib/nokogiri/xml/sax/push_parser.rb
237
238
  - lib/nokogiri/xml/schema.rb
@@ -250,14 +251,18 @@ files:
250
251
  - test/ffi/test_document.rb
251
252
  - test/files/address_book.rlx
252
253
  - test/files/address_book.xml
254
+ - test/files/bar/bar.xsd
253
255
  - test/files/dont_hurt_em_why.xml
254
256
  - test/files/exslt.xml
255
257
  - test/files/exslt.xslt
258
+ - test/files/foo/foo.xsd
256
259
  - test/files/po.xml
257
260
  - test/files/po.xsd
261
+ - test/files/snuggles.xml
258
262
  - test/files/staff.xml
259
263
  - test/files/staff.xslt
260
264
  - test/files/tlm.html
265
+ - test/files/valid_bar.xml
261
266
  - test/helper.rb
262
267
  - test/hpricot/files/basic.xhtml
263
268
  - test/hpricot/files/boingboing.html
@@ -319,7 +324,7 @@ files:
319
324
  - test/xml/test_unparented_node.rb
320
325
  - test/xml/test_xpath.rb
321
326
  has_rdoc: true
322
- homepage: http://nokogiri.rubyforge.org/
327
+ homepage: http://nokogiri.org/
323
328
  licenses: []
324
329
 
325
330
  post_install_message:
@@ -344,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
349
  requirements: []
345
350
 
346
351
  rubyforge_project: nokogiri
347
- rubygems_version: 1.3.3
352
+ rubygems_version: 1.3.4
348
353
  signing_key:
349
354
  specification_version: 3
350
355
  summary: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser"