libxml-fixed-jruby 1.0.0-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +91 -0
  3. data/README.txt +50 -0
  4. data/Rakefile +40 -0
  5. data/lib/libxml-jruby.rb +84 -0
  6. data/lib/libxml-jruby/xml.rb +1 -0
  7. data/lib/libxml-jruby/xml/attr.rb +46 -0
  8. data/lib/libxml-jruby/xml/attributes.rb +68 -0
  9. data/lib/libxml-jruby/xml/document.rb +52 -0
  10. data/lib/libxml-jruby/xml/dtd.rb +25 -0
  11. data/lib/libxml-jruby/xml/node.rb +285 -0
  12. data/lib/libxml-jruby/xml/ns.rb +19 -0
  13. data/lib/libxml-jruby/xml/parser.rb +121 -0
  14. data/lib/libxml-jruby/xml/xpath.rb +98 -0
  15. data/lib/libxml.rb +1 -0
  16. data/lib/xml.rb +13 -0
  17. data/lib/xml/libxml.rb +8 -0
  18. data/script/benchmark/depixelate.rb +633 -0
  19. data/script/benchmark/hamlet.xml +9055 -0
  20. data/script/benchmark/sock_entries.xml +507 -0
  21. data/script/benchmark/throughput.rb +40 -0
  22. data/script/benchmark/xml_benchmarks.rb +228 -0
  23. data/script/test +6 -0
  24. data/tasks/ann.rake +81 -0
  25. data/tasks/bones.rake +21 -0
  26. data/tasks/gem.rake +126 -0
  27. data/tasks/git.rake +41 -0
  28. data/tasks/manifest.rake +49 -0
  29. data/tasks/notes.rake +28 -0
  30. data/tasks/post_load.rake +39 -0
  31. data/tasks/rdoc.rake +51 -0
  32. data/tasks/rubyforge.rake +57 -0
  33. data/tasks/setup.rb +268 -0
  34. data/tasks/spec.rake +55 -0
  35. data/tasks/svn.rake +48 -0
  36. data/tasks/test.rake +38 -0
  37. data/test/etc_doc_to_s.rb +19 -0
  38. data/test/ets_copy_bug.rb +21 -0
  39. data/test/ets_copy_bug3.rb +38 -0
  40. data/test/ets_doc_file.rb +15 -0
  41. data/test/ets_doc_to_s.rb +21 -0
  42. data/test/ets_gpx.rb +26 -0
  43. data/test/ets_node_gc.rb +21 -0
  44. data/test/ets_test.xml +2 -0
  45. data/test/ets_tsr.rb +9 -0
  46. data/test/model/books.xml +147 -0
  47. data/test/model/default_validation_bug.rb +0 -0
  48. data/test/model/merge_bug_data.xml +58 -0
  49. data/test/model/rubynet.xml +78 -0
  50. data/test/model/rubynet_project +1 -0
  51. data/test/model/saxtest.xml +5 -0
  52. data/test/model/shiporder.rnc +28 -0
  53. data/test/model/shiporder.rng +86 -0
  54. data/test/model/shiporder.xml +23 -0
  55. data/test/model/shiporder.xsd +31 -0
  56. data/test/model/simple.xml +7 -0
  57. data/test/model/soap.xml +27 -0
  58. data/test/model/xinclude.xml +5 -0
  59. data/test/tc_attributes.rb +110 -0
  60. data/test/tc_deprecated_require.rb +13 -0
  61. data/test/tc_document.rb +97 -0
  62. data/test/tc_document_write.rb +139 -0
  63. data/test/tc_dtd.rb +70 -0
  64. data/test/tc_html_parser.rb +63 -0
  65. data/test/tc_node.rb +108 -0
  66. data/test/tc_node_attr.rb +176 -0
  67. data/test/tc_node_cdata.rb +51 -0
  68. data/test/tc_node_comment.rb +32 -0
  69. data/test/tc_node_copy.rb +40 -0
  70. data/test/tc_node_edit.rb +98 -0
  71. data/test/tc_node_set.rb +24 -0
  72. data/test/tc_node_set2.rb +37 -0
  73. data/test/tc_node_text.rb +17 -0
  74. data/test/tc_node_xlink.rb +28 -0
  75. data/test/tc_ns.rb +18 -0
  76. data/test/tc_parser.rb +308 -0
  77. data/test/tc_parser_context.rb +126 -0
  78. data/test/tc_properties.rb +37 -0
  79. data/test/tc_reader.rb +112 -0
  80. data/test/tc_relaxng.rb +39 -0
  81. data/test/tc_sax_parser.rb +113 -0
  82. data/test/tc_schema.rb +39 -0
  83. data/test/tc_traversal.rb +220 -0
  84. data/test/tc_well_formed.rb +11 -0
  85. data/test/tc_xinclude.rb +26 -0
  86. data/test/tc_xpath.rb +130 -0
  87. data/test/tc_xpath_context.rb +72 -0
  88. data/test/tc_xpointer.rb +78 -0
  89. data/test/test_libxml-jruby.rb +0 -0
  90. data/test/test_suite.rb +31 -0
  91. data/test/ts_working.rb +31 -0
  92. metadata +146 -0
@@ -0,0 +1,55 @@
1
+ # $Id$
2
+
3
+ if HAVE_SPEC_RAKE_SPECTASK
4
+ require 'spec/rake/verify_rcov'
5
+
6
+ namespace :spec do
7
+
8
+ desc 'Run all specs with basic output'
9
+ Spec::Rake::SpecTask.new(:run) do |t|
10
+ t.ruby_opts = PROJ.ruby_opts
11
+ t.spec_opts = PROJ.spec.opts
12
+ t.spec_files = PROJ.spec.files
13
+ t.libs += PROJ.libs
14
+ end
15
+
16
+ desc 'Run all specs with text output'
17
+ Spec::Rake::SpecTask.new(:specdoc) do |t|
18
+ t.ruby_opts = PROJ.ruby_opts
19
+ t.spec_opts = PROJ.spec.opts + ['--format', 'specdoc']
20
+ t.spec_files = PROJ.spec.files
21
+ t.libs += PROJ.libs
22
+ end
23
+
24
+ if HAVE_RCOV
25
+ desc 'Run all specs with RCov'
26
+ Spec::Rake::SpecTask.new(:rcov) do |t|
27
+ t.ruby_opts = PROJ.ruby_opts
28
+ t.spec_opts = PROJ.spec.opts
29
+ t.spec_files = PROJ.spec.files
30
+ t.libs += PROJ.libs
31
+ t.rcov = true
32
+ t.rcov_dir = PROJ.rcov.dir
33
+ t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
34
+ end
35
+
36
+ RCov::VerifyTask.new(:verify) do |t|
37
+ t.threshold = PROJ.rcov.threshold
38
+ t.index_html = File.join(PROJ.rcov.dir, 'index.html')
39
+ t.require_exact_threshold = PROJ.rcov.threshold_exact
40
+ end
41
+
42
+ task :verify => :rcov
43
+ remove_desc_for_task %w(spec:clobber_rcov)
44
+ end
45
+
46
+ end # namespace :spec
47
+
48
+ desc 'Alias to spec:run'
49
+ task :spec => 'spec:run'
50
+
51
+ task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
52
+
53
+ end # if HAVE_SPEC_RAKE_SPECTASK
54
+
55
+ # EOF
@@ -0,0 +1,48 @@
1
+ # $Id$
2
+
3
+ if HAVE_SVN
4
+
5
+ unless PROJ.svn.root
6
+ info = %x/svn info ./
7
+ m = %r/^Repository Root:\s+(.*)$/.match(info)
8
+ PROJ.svn.root = (m.nil? ? '' : m[1])
9
+ end
10
+ PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
11
+
12
+ namespace :svn do
13
+
14
+ # A prerequisites task that all other tasks depend upon
15
+ task :prereqs
16
+
17
+ desc 'Show tags from the SVN repository'
18
+ task :show_tags => 'svn:prereqs' do |t|
19
+ tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
20
+ tags.gsub!(%r/\/$/, '')
21
+ tags = tags.split("\n").sort {|a,b| b <=> a}
22
+ puts tags
23
+ end
24
+
25
+ desc 'Create a new tag in the SVN repository'
26
+ task :create_tag => 'svn:prereqs' do |t|
27
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
28
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
29
+
30
+ svn = PROJ.svn
31
+ trunk = File.join(svn.root, svn.trunk)
32
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
33
+ tag = File.join(svn.root, svn.tags, tag)
34
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
35
+
36
+ puts "Creating SVN tag '#{tag}'"
37
+ unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
38
+ abort "Tag creation failed"
39
+ end
40
+ end
41
+
42
+ end # namespace :svn
43
+
44
+ task 'gem:release' => 'svn:create_tag'
45
+
46
+ end # if PROJ.svn.path
47
+
48
+ # EOF
@@ -0,0 +1,38 @@
1
+ # $Id$
2
+
3
+ require 'rake/testtask'
4
+
5
+ namespace :test do
6
+
7
+ Rake::TestTask.new(:run) do |t|
8
+ t.libs = PROJ.libs
9
+ t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
10
+ else PROJ.test.files end
11
+ t.ruby_opts += PROJ.ruby_opts
12
+ t.ruby_opts += PROJ.test.opts
13
+ end
14
+
15
+ if HAVE_RCOV
16
+ desc 'Run rcov on the unit tests'
17
+ task :rcov => :clobber_rcov do
18
+ opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
19
+ opts = opts.join(' ')
20
+ files = if test(?f, PROJ.test.file) then [PROJ.test.file]
21
+ else PROJ.test.files end
22
+ files = files.join(' ')
23
+ sh "#{RCOV} #{files} #{opts}"
24
+ end
25
+
26
+ task :clobber_rcov do
27
+ rm_r 'coverage' rescue nil
28
+ end
29
+ end
30
+
31
+ end # namespace :test
32
+
33
+ desc 'Alias to test:run'
34
+ task :test => 'test:run'
35
+
36
+ task :clobber => 'test:clobber_rcov' if HAVE_RCOV
37
+
38
+ # EOF
@@ -0,0 +1,19 @@
1
+ require 'xml'
2
+
3
+ 1.times do |count|
4
+
5
+ xml_doc = XML::Document.new()
6
+ xml_doc.encoding = "UTF-8"
7
+ xml_doc.root = XML::Node.new("Request")
8
+
9
+ 1000.times do |index|
10
+ xml_doc.root << node = XML::Node.new("row")
11
+ node["user_id"] = index.to_s
12
+ node << "600445"
13
+ end
14
+
15
+ xml_str = xml_doc.to_s
16
+ print "\r#{count}"
17
+ $stdout.flush
18
+ end
19
+ puts "\n"
@@ -0,0 +1,21 @@
1
+ require 'xml'
2
+
3
+ def test( doc2 )
4
+ doc = XML::Document.new('1.0')
5
+ doc.root = XML::Node.new("ccc")
6
+ doc.root['aaa'] = 'aaa'
7
+ doc.root.child_add(doc2.root.copy(true)) # BUG!
8
+ doc.root << doc2.root.copy(true)
9
+ return doc
10
+ end
11
+
12
+ def test2
13
+ doc2 = XML::Document.new('1.0')
14
+ doc2.root = XML::Node.new("aaa")
15
+ test( doc2 )
16
+ end
17
+
18
+ 1000.times { |i|
19
+ print "\r#{i}"; $stdout.flush
20
+ test2
21
+ }
@@ -0,0 +1,38 @@
1
+ require 'xml'
2
+
3
+ str = <<-STR
4
+ <html>
5
+ <body>
6
+ <div class="textarea" id="t1"
7
+ style="STATIC">werwerwerwerwer </div>
8
+ <div class="textarea" id="t2" style="STATIC">
9
+ Quisque et diam dapibus nisi bibendum blandit.
10
+ </div>
11
+ <div class="textarea" id="t3" style="STATIC">
12
+ <p>aaaaaaaaa</p>
13
+ </div>
14
+ </body>
15
+ </html>
16
+ STR
17
+
18
+ XML::Parser.default_keep_blanks = false
19
+ xp = XML::Parser.new
20
+ xp.string = str
21
+ doc = xp.parse
22
+
23
+ xpath = "//div[@id='t1']"
24
+ div1 = doc.find(xpath).to_a[0]
25
+ printf "xxx div1: #{div1}\n"
26
+
27
+ xpath = "//div[@id='t2']"
28
+ div2 = doc.find(xpath).to_a[0]
29
+ printf "xxx div2: #{div2}\n"
30
+
31
+
32
+ div2.each do |child|
33
+ #c = child.clone
34
+ c = child.copy(false)
35
+ div1.child_add(c)
36
+ end
37
+
38
+ printf "xxx root: #{doc.root}\n"
@@ -0,0 +1,15 @@
1
+ require 'xml'
2
+
3
+ # This is related to bug 8337, complaint is on amd64/fbsd
4
+ # unknown if it happens on other amd64/os combos
5
+
6
+ Process.setrlimit(Process::RLIMIT_NOFILE,10005)
7
+
8
+ (1..10000).each{|time|
9
+ XML::Document.file(File.join(File.dirname(__FILE__),'ets_test.xml'))
10
+ if time % 100 == 0
11
+ print "\r#{time}"
12
+ $stdout.flush
13
+ end
14
+ }
15
+ puts "\n"
@@ -0,0 +1,21 @@
1
+ require 'xml'
2
+
3
+ 100.times do |count|
4
+
5
+ xml_doc = XML::Document.new()
6
+ xml_doc.encoding = "UTF-8"
7
+ xml_doc.root = XML::Node.new("Request")
8
+
9
+ 1000.times do |index|
10
+
11
+ xml_doc.root << node = XML::Node.new("row")
12
+ node["user_id"] = index.to_s
13
+ node << "600445"
14
+
15
+ end
16
+
17
+ xml_str = xml_doc.to_s
18
+ print "\r#{count}"
19
+ $stdout.flush
20
+ end
21
+ puts "\n"
@@ -0,0 +1,26 @@
1
+ require 'libxml'
2
+
3
+ 100.times do
4
+ doc = XML::Document.new
5
+ doc.encoding = 'UTF-8'
6
+
7
+ root = XML::Node.new 'gpx'
8
+ root['version'] = '1.0'
9
+ root['creator'] = 'OpenStreetMap.org'
10
+ root['xmlns'] = "http://www.topografix.com/GPX/1/0/"
11
+
12
+ doc.root = root
13
+
14
+ track = XML::Node.new 'trk'
15
+ doc.root << track
16
+
17
+ trkseg = XML::Node.new 'trkseg'
18
+ track << trkseg
19
+
20
+ 1.upto(1000) do |n|
21
+ trkpt = XML::Node.new 'trkpt'
22
+ trkpt['lat'] = n.to_s
23
+ trkpt['lon'] = n.to_s
24
+ trkseg << trkpt
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ require 'xml'
2
+
3
+ # test of bug 13310, clears MEM2
4
+
5
+ include GC
6
+
7
+ inner = XML::Node.new('inner')
8
+ save = nil
9
+ 1.times do
10
+ outer = XML::Node.new('outer')
11
+ outer.child = inner
12
+ 1.times do
13
+ doc = XML::Document.new
14
+ doc.root = outer
15
+ # Uncomment the following line and it won't crash
16
+ save = doc
17
+ end
18
+ garbage_collect
19
+ end
20
+ garbage_collect
21
+ puts inner
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0"?>
2
+ <test/>
@@ -0,0 +1,9 @@
1
+ require 'xml'
2
+
3
+ 10_000.times {|n|
4
+ j=XML::Node.new2(nil,"happy#{n}")
5
+ 10.times {|r|
6
+ j1=XML::Node.new("happy#{r}","farts")
7
+ j.child=j1
8
+ }
9
+ }
@@ -0,0 +1,147 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Sample xml file from Microsoft.
3
+ See http://msdn.microsoft.com/en-us/library/ms762271(VS.85).aspx -->
4
+ <catalog>
5
+ <book id="bk101">
6
+ <author>Gambardella, Matthew</author>
7
+ <title>XML Developer's Guide</title>
8
+ <genre>Computer</genre>
9
+ <price>44.95</price>
10
+ <publish_date>2000-10-01</publish_date>
11
+ <description>
12
+ An in-depth look at creating applications
13
+ with XML.
14
+ </description>
15
+ </book>
16
+ <book id="bk102">
17
+ <author>Ralls, Kim</author>
18
+ <title>Midnight Rain</title>
19
+ <genre>Fantasy</genre>
20
+ <price>5.95</price>
21
+ <publish_date>2000-12-16</publish_date>
22
+ <description>
23
+ A former architect battles corporate zombies,
24
+ an evil sorceress, and her own childhood to become queen
25
+ of the world.
26
+ </description>
27
+ </book>
28
+ <book id="bk103">
29
+ <author>Corets, Eva</author>
30
+ <title>Maeve Ascendant</title>
31
+ <genre>Fantasy</genre>
32
+ <price>5.95</price>
33
+ <publish_date>2000-11-17</publish_date>
34
+ <description>
35
+ After the collapse of a nanotechnology
36
+ society in England, the young survivors lay the
37
+ foundation for a new society.
38
+ </description>
39
+ </book>
40
+ <book id="bk104">
41
+ <author>Corets, Eva</author>
42
+ <title>Oberon's Legacy</title>
43
+ <genre>Fantasy</genre>
44
+ <price>5.95</price>
45
+ <publish_date>2001-03-10</publish_date>
46
+ <description>
47
+ In post-apocalypse England, the mysterious
48
+ agent known only as Oberon helps to create a new life
49
+ for the inhabitants of London. Sequel to Maeve
50
+ Ascendant.
51
+ </description>
52
+ </book>
53
+ <book id="bk105">
54
+ <author>Corets, Eva</author>
55
+ <title>The Sundered Grail</title>
56
+ <genre>Fantasy</genre>
57
+ <price>5.95</price>
58
+ <publish_date>2001-09-10</publish_date>
59
+ <description>
60
+ The two daughters of Maeve, half-sisters,
61
+ battle one another for control of England. Sequel to
62
+ Oberon's Legacy.
63
+ </description>
64
+ </book>
65
+ <book id="bk106">
66
+ <author>Randall, Cynthia</author>
67
+ <title>Lover Birds</title>
68
+ <genre>Romance</genre>
69
+ <price>4.95</price>
70
+ <publish_date>2000-09-02</publish_date>
71
+ <description>
72
+ When Carla meets Paul at an ornithology
73
+ conference, tempers fly as feathers get ruffled.
74
+ </description>
75
+ </book>
76
+ <book id="bk107">
77
+ <author>Thurman, Paula</author>
78
+ <title>Splish Splash</title>
79
+ <genre>Romance</genre>
80
+ <price>4.95</price>
81
+ <publish_date>2000-11-02</publish_date>
82
+ <description>
83
+ A deep sea diver finds true love twenty
84
+ thousand leagues beneath the sea.
85
+ </description>
86
+ </book>
87
+ <book id="bk108">
88
+ <author>Knorr, Stefan</author>
89
+ <title>Creepy Crawlies</title>
90
+ <genre>Horror</genre>
91
+ <price>4.95</price>
92
+ <publish_date>2000-12-06</publish_date>
93
+ <description>
94
+ An anthology of horror stories about roaches,
95
+ centipedes, scorpions and other insects.
96
+ </description>
97
+ </book>
98
+ <book id="bk109">
99
+ <author>Kress, Peter</author>
100
+ <title>Paradox Lost</title>
101
+ <genre>Science Fiction</genre>
102
+ <price>6.95</price>
103
+ <publish_date>2000-11-02</publish_date>
104
+ <description>
105
+ After an inadvertant trip through a Heisenberg
106
+ Uncertainty Device, James Salway discovers the problems
107
+ of being quantum.
108
+ </description>
109
+ </book>
110
+ <book id="bk110">
111
+ <author>O'Brien, Tim</author>
112
+ <title>Microsoft .NET: The Programming Bible</title>
113
+ <genre>Computer</genre>
114
+ <price>36.95</price>
115
+ <publish_date>2000-12-09</publish_date>
116
+ <description>
117
+ Microsoft's .NET initiative is explored in
118
+ detail in this deep programmer's reference.
119
+ </description>
120
+ </book>
121
+ <book id="bk111">
122
+ <author>O'Brien, Tim</author>
123
+ <title>MSXML3: A Comprehensive Guide</title>
124
+ <genre>Computer</genre>
125
+ <price>36.95</price>
126
+ <publish_date>2000-12-01</publish_date>
127
+ <description>
128
+ The Microsoft MSXML3 parser is covered in
129
+ detail, with attention to XML DOM interfaces, XSLT processing,
130
+ SAX and more.
131
+ </description>
132
+ </book>
133
+ <book id="bk112">
134
+ <author>Galos, Mike</author>
135
+ <title>Visual Studio 7: A Comprehensive Guide</title>
136
+ <genre>Computer</genre>
137
+ <price>49.95</price>
138
+ <publish_date>2001-04-16</publish_date>
139
+ <description>
140
+ Microsoft Visual Studio 7 is explored in depth,
141
+ looking at how Visual Basic, Visual C++, C#, and ASP+ are
142
+ integrated into a comprehensive development
143
+ environment.
144
+ </description>
145
+ </book>
146
+ </catalog>
147
+