libxml-ruby 0.7.0-x86-mswin32-60 → 0.8.0-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +24 -1
- data/README +48 -3
- data/benchmark/depixelate.rb +632 -0
- data/benchmark/hamlet.xml +9055 -0
- data/benchmark/sock_entries.xml +507 -0
- data/benchmark/throughput.rb +39 -0
- data/benchmark/xml_benchmarks.rb +222 -0
- data/doc/classes/LibXML.html +237 -0
- data/doc/classes/LibXML/XML.html +178 -0
- data/doc/classes/{XML → LibXML/XML}/Attr.html +213 -182
- data/doc/classes/{XML → LibXML/XML}/Attributes.html +126 -54
- data/doc/classes/{XML → LibXML/XML}/Document.html +299 -297
- data/doc/classes/{XML → LibXML/XML}/Dtd.html +10 -10
- data/doc/classes/{XML/XInclude → LibXML/XML}/Error.html +4 -4
- data/doc/classes/{XML → LibXML/XML}/HTMLParser.html +40 -40
- data/doc/classes/{XML → LibXML/XML}/InputCallbacks.html +10 -10
- data/doc/classes/{XML → LibXML/XML}/NS.html +46 -46
- data/doc/classes/{XML → LibXML/XML}/Node.html +935 -788
- data/doc/classes/LibXML/XML/Node/FailedModify.html +111 -0
- data/doc/classes/{XML → LibXML/XML}/Node/Set.html +69 -68
- data/doc/classes/{XML → LibXML/XML}/Node/SetNamespace.html +4 -4
- data/doc/classes/{XML/Node/FailedModify.html → LibXML/XML/Node/UnknownType.html} +4 -4
- data/doc/classes/{XML → LibXML/XML}/Parser.html +426 -389
- data/doc/classes/{XML → LibXML/XML}/Parser/Context.html +208 -208
- data/doc/classes/{XML → LibXML/XML}/Parser/ParseError.html +4 -4
- data/doc/classes/{XML → LibXML/XML}/Reader.html +288 -287
- data/doc/classes/{XML → LibXML/XML}/SaxParser.html +52 -52
- data/doc/classes/{XML/XPath/Context.html → LibXML/XML/Schema.html} +60 -32
- data/doc/classes/{XML → LibXML/XML}/State.html +4 -4
- data/doc/classes/{XML/Node/UnknownType.html → LibXML/XML/Tree.html} +5 -5
- data/doc/classes/{XML → LibXML/XML}/XInclude.html +5 -5
- data/doc/classes/{XML → LibXML/XML/XInclude}/Error.html +5 -5
- data/doc/classes/{XML → LibXML/XML}/XMLParserOptions.html +5 -5
- data/doc/classes/{XML → LibXML/XML}/XPath.html +23 -64
- data/doc/classes/LibXML/XML/XPath/Context.html +403 -0
- data/doc/classes/{XML/XPointer/Context → LibXML/XML/XPath}/InvalidPath.html +4 -4
- data/doc/classes/LibXML/XML/XPath/Object.html +623 -0
- data/doc/classes/{XML → LibXML/XML}/XPointer.html +12 -12
- data/doc/classes/{XML → LibXML/XML}/XPointer/Context.html +5 -5
- data/doc/classes/{XML/XPath → LibXML/XML/XPointer/Context}/InvalidPath.html +5 -5
- data/doc/classes/{XML → LibXML/XML}/XPointer/InvalidExpression.html +4 -4
- data/doc/classes/XML.html +17 -123
- data/doc/created.rid +1 -1
- data/doc/files/CHANGES.html +49 -25
- data/doc/files/LICENSE.html +1 -1
- data/doc/files/README.html +79 -4
- data/doc/files/VERSION.html +2 -2
- data/doc/files/ext/libxml/cbg_c.html +1 -1
- data/doc/files/ext/libxml/libxml_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_attr_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_attributes_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_document_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_dtd_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_html_parser_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_input_cbg_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_node_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_node_set_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_ns_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_parser_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_parser_context_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_reader_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_sax_parser_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_schema_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_state_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xinclude_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpath_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpath_context_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpath_object_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpointer_c.html +1 -1
- data/doc/files/ext/libxml/ruby_xml_xpointer_context_c.html +1 -1
- data/doc/files/lib/libxml/attr_rb.html +108 -0
- data/doc/files/lib/libxml/attributes_rb.html +108 -0
- data/doc/files/lib/libxml/document_rb.html +108 -0
- data/doc/files/lib/libxml/node_rb.html +108 -0
- data/doc/files/lib/libxml/node_set_rb.html +108 -0
- data/doc/files/lib/libxml/parser_options_rb.html +107 -0
- data/doc/files/{ext/libxml/ruby_xml_tree_c.html → lib/libxml/parser_rb.html} +4 -4
- data/doc/files/lib/libxml/properties_rb.html +108 -0
- data/doc/files/lib/libxml/tree_rb.html +107 -0
- data/doc/files/lib/libxml_rb.html +12 -3
- data/doc/fr_class_index.html +34 -32
- data/doc/fr_file_index.html +9 -1
- data/doc/fr_method_index.html +362 -347
- data/ext/libxml/cbg.c +76 -76
- data/ext/libxml/libxml.c +4 -3
- data/ext/libxml/ruby_libxml.h +1 -1
- data/ext/libxml/ruby_xml_attr.c +4 -3
- data/ext/libxml/ruby_xml_attr.h +16 -16
- data/ext/libxml/ruby_xml_attributes.c +267 -266
- data/ext/libxml/ruby_xml_attributes.h +17 -17
- data/ext/libxml/ruby_xml_document.c +30 -59
- data/ext/libxml/ruby_xml_document.h +27 -27
- data/ext/libxml/ruby_xml_dtd.c +2 -1
- data/ext/libxml/ruby_xml_dtd.h +17 -17
- data/ext/libxml/ruby_xml_html_parser.c +3 -2
- data/ext/libxml/ruby_xml_html_parser.h +29 -29
- data/ext/libxml/ruby_xml_input_cbg.c +2 -1
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_node.c +127 -470
- data/ext/libxml/ruby_xml_node.h +17 -17
- data/ext/libxml/ruby_xml_node_set.c +5 -4
- data/ext/libxml/ruby_xml_node_set.h +20 -20
- data/ext/libxml/ruby_xml_ns.c +3 -2
- data/ext/libxml/ruby_xml_ns.h +12 -12
- data/ext/libxml/ruby_xml_parser.c +20 -48
- data/ext/libxml/ruby_xml_parser.h +31 -31
- data/ext/libxml/ruby_xml_parser_context.c +3 -2
- data/ext/libxml/ruby_xml_parser_context.h +20 -20
- data/ext/libxml/ruby_xml_reader.c +2 -1
- data/ext/libxml/ruby_xml_sax_parser.c +3 -2
- data/ext/libxml/ruby_xml_sax_parser.h +56 -56
- data/ext/libxml/ruby_xml_schema.c +6 -0
- data/ext/libxml/ruby_xml_schema.h +16 -16
- data/ext/libxml/ruby_xml_state.c +13 -12
- data/ext/libxml/ruby_xml_state.h +1 -1
- data/ext/libxml/ruby_xml_xinclude.c +3 -2
- data/ext/libxml/ruby_xml_xinclude.h +13 -13
- data/ext/libxml/ruby_xml_xpath.c +35 -228
- data/ext/libxml/ruby_xml_xpath.h +22 -23
- data/ext/libxml/ruby_xml_xpath_context.c +223 -62
- data/ext/libxml/ruby_xml_xpath_context.h +15 -20
- data/ext/libxml/ruby_xml_xpath_object.c +63 -19
- data/ext/libxml/ruby_xml_xpointer.c +19 -15
- data/ext/libxml/ruby_xml_xpointer.h +27 -27
- data/ext/libxml/ruby_xml_xpointer_context.c +3 -2
- data/ext/libxml/ruby_xml_xpointer_context.h +18 -18
- data/ext/libxml/version.h +9 -9
- data/lib/libxml.rb +16 -128
- data/lib/libxml/attr.rb +45 -0
- data/lib/libxml/attributes.rb +15 -0
- data/lib/libxml/document.rb +54 -0
- data/lib/libxml/node.rb +132 -0
- data/lib/libxml/node_set.rb +27 -0
- data/lib/libxml/parser.rb +42 -0
- data/lib/libxml/parser_options.rb +25 -0
- data/lib/libxml/properties.rb +19 -0
- data/lib/libxml/tree.rb +29 -0
- data/lib/libxml_ruby.so +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/{work/task/setup → setup.rb} +1585 -1616
- data/test/gc.log +0 -0
- data/test/model/books.xml +147 -0
- data/{work/test/runner.rb → test/model/default_validation_bug.rb} +0 -0
- data/test/model/merge_bug_data.xml +58 -0
- data/test/model/rubynet.xml +78 -0
- data/test/model/rubynet_project +1 -0
- data/test/model/saxtest.xml +5 -0
- data/test/model/shiporder.xml +23 -0
- data/test/model/shiporder.xsd +31 -0
- data/test/model/simple.xml +7 -0
- data/test/model/soap.xml +27 -0
- data/test/model/xinclude.xml +5 -0
- data/test/tc_deprecated_require.rb +13 -0
- data/test/tc_xml_document.rb +57 -16
- data/test/tc_xml_document_write.rb +125 -10
- data/test/tc_xml_dtd.rb +22 -1
- data/test/tc_xml_node.rb +13 -0
- data/test/tc_xml_node_edit.rb +1 -1
- data/test/tc_xml_node_xlink.rb +1 -1
- data/test/tc_xml_parser.rb +64 -7
- data/test/tc_xml_properties.rb +42 -0
- data/test/tc_xml_reader.rb +4 -4
- data/test/tc_xml_sax_parser.rb +50 -50
- data/test/tc_xml_schema.rb +2 -2
- data/test/tc_xml_traversal.rb +220 -0
- data/test/tc_xml_xinclude.rb +12 -15
- data/test/tc_xml_xpath.rb +74 -6
- data/test/tc_xml_xpath_context.rb +72 -0
- data/test/test_suite.rb +6 -4
- data/vc/libxml_ruby.vcproj +1 -9
- metadata +92 -65
- data/doc/classes/XML/SiblingEnum.html +0 -142
- data/doc/classes/XML/Tree.html +0 -224
- data/doc/classes/XML/XPath/Object.html +0 -439
- data/ext/libxml/ruby_xml_tree.c +0 -43
- data/ext/libxml/ruby_xml_tree.h +0 -12
- data/test/ets_copy_bug2.rb +0 -21
- data/test/tc_xml_document_write2.rb +0 -54
- data/test/tc_xml_document_write3.rb +0 -96
- data/test/tc_xml_sax_parser2.rb +0 -51
- data/work/Rakefile +0 -247
- data/work/task/make +0 -26
- data/work/task/memory +0 -37
- data/work/task/rdoc +0 -39
- data/work/task/test +0 -29
- data/work/test/ets_runner.rb +0 -33
- data/work/test/libxml_test.rb +0 -3
- data/work/test/runner_ets.rb +0 -33
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'hpricot'
|
3
|
+
require 'libxml'
|
4
|
+
require 'rexml/document'
|
5
|
+
|
6
|
+
ITERATIONS = 3
|
7
|
+
NESTED_ITERATIONS = 5
|
8
|
+
|
9
|
+
def bm(name, filename, &block)
|
10
|
+
text = File.open(filename).read
|
11
|
+
length = text.length / 1024.0 / 1024.0
|
12
|
+
puts "#{filename}: #{name} (#{(length * 1024).round} kb)"
|
13
|
+
for j in 0 .. NESTED_ITERATIONS
|
14
|
+
s = Time.now.to_f
|
15
|
+
for i in 0 .. ITERATIONS
|
16
|
+
block.call(text)
|
17
|
+
end
|
18
|
+
timer = Time.now.to_f - s
|
19
|
+
puts "\t#{length * ITERATIONS / timer} MB/s"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def bm_suite(filenames)
|
24
|
+
filenames.each do |filename|
|
25
|
+
bm("LIBXML THROUGHPUT:", filename) do |text|
|
26
|
+
XML::Document.file(filename)
|
27
|
+
end
|
28
|
+
|
29
|
+
bm("HPRICOT THROUGHPUT:", filename) do |text|
|
30
|
+
Hpricot.XML(text)
|
31
|
+
end
|
32
|
+
|
33
|
+
bm("REXML THROUGHPUT:", filename) do |text|
|
34
|
+
REXML::Document.new(text)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
bm_suite("hamlet.xml")
|
@@ -0,0 +1,222 @@
|
|
1
|
+
# From: https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks/
|
2
|
+
#
|
3
|
+
# Each test has an XML Parser open a 98k XML document
|
4
|
+
# and count one type of leaf element (466 entries).
|
5
|
+
# This is repeated a total of 50 time sfor each Parser.
|
6
|
+
#
|
7
|
+
# These results were produced on:
|
8
|
+
# MacBook Pro
|
9
|
+
# 2.33 GHz Intel Core 2 Duo
|
10
|
+
# 4 GB memory
|
11
|
+
# running MacOS X 10.5.2
|
12
|
+
#
|
13
|
+
# Ruby versions tested:
|
14
|
+
# MRI: ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]
|
15
|
+
# JRuby: ruby 1.8.6 (2008-03-20 rev 6255) [i386-jruby1.1RC3] on Java 1.5.0_13
|
16
|
+
# JRuby: ruby 1.8.6 (2008-03-20 rev 6255) [i386-jruby1.1RC3] on Java 1.6.0_03 (Soylatte)
|
17
|
+
#
|
18
|
+
# Library versions MRI:
|
19
|
+
# libxml-ruby 0.5.2.0
|
20
|
+
# hpricot 0.6
|
21
|
+
#
|
22
|
+
# Library versions JRuby:
|
23
|
+
# hpricot 0.6.161
|
24
|
+
# jrexml 0.5.3
|
25
|
+
#
|
26
|
+
# Summary data: 100 iterations, timings from second set
|
27
|
+
#
|
28
|
+
# Platform and method total time
|
29
|
+
# -----------------------------------------------------------
|
30
|
+
# JRuby (Java 1.6.0) jdom_document_builder 0.363
|
31
|
+
# MRI: libxml 0.389
|
32
|
+
# JRuby (Java 1.6.0 server) jdom_document_builder 0.412
|
33
|
+
# JRuby (server) jdom_document_builder 0.617
|
34
|
+
# JRuby: jdom_document_builder 1.451
|
35
|
+
# MRI: hpricot 2.056
|
36
|
+
# JRuby (Java 1.6.0 server) hpricot 2.272
|
37
|
+
# JRuby (Java 1.6.0) hpricot 2.273
|
38
|
+
# JRuby (server) hpricot 3.447
|
39
|
+
# JRuby: hpricot 6.198
|
40
|
+
# JRuby (Java 1.6.0 server) rexml 6.251
|
41
|
+
# JRuby (Java 1.6.0) rexml 6.356
|
42
|
+
# MRI: rexml 7.624
|
43
|
+
# JRuby (server) rexml 9.609
|
44
|
+
# JRuby: rexml 12.944
|
45
|
+
#
|
46
|
+
# Detailed data:
|
47
|
+
#
|
48
|
+
# $ ruby ./xml_benchmarks.rb
|
49
|
+
#
|
50
|
+
# Ruby version: MRI 1.8.6 (2007-09-24 rev 111), platform: universal-darwin9.0
|
51
|
+
#
|
52
|
+
# 100 times: Open 98k XML document and count one type of leaf element (466 entries)
|
53
|
+
#
|
54
|
+
# Rehearsal -------------------------------------------
|
55
|
+
# rexml 7.650000 0.040000 7.690000 ( 7.692767)
|
56
|
+
# hpricot 2.100000 0.030000 2.130000 ( 2.133564)
|
57
|
+
# libxml 0.390000 0.030000 0.420000 ( 0.419391)
|
58
|
+
# --------------------------------- total: 10.240000sec
|
59
|
+
#
|
60
|
+
# user system total real
|
61
|
+
# rexml 7.600000 0.010000 7.610000 ( 7.624436)
|
62
|
+
# hpricot 2.040000 0.020000 2.060000 ( 2.056690)
|
63
|
+
# libxml 0.380000 0.010000 0.390000 ( 0.389298)
|
64
|
+
#
|
65
|
+
# $ jruby ./xml_benchmarks.rb
|
66
|
+
#
|
67
|
+
# Ruby version: JRuby 1.8.6 (2008-03-20 rev 6255) [i386-jruby1.1RC3], platform: Java: version: 1.5.0_13
|
68
|
+
#
|
69
|
+
# 100 times: Open 98k XML document and count one type of leaf element (466 entries)
|
70
|
+
#
|
71
|
+
# Rehearsal ---------------------------------------------------------
|
72
|
+
# rexml 14.063000 0.000000 14.063000 ( 14.063000)
|
73
|
+
# hpricot 6.579000 0.000000 6.579000 ( 6.579000)
|
74
|
+
# jdom_document_builder 2.211000 0.000000 2.211000 ( 2.211000)
|
75
|
+
# ----------------------------------------------- total: 22.853000sec
|
76
|
+
#
|
77
|
+
# user system total real
|
78
|
+
# rexml 12.944000 0.000000 12.944000 ( 12.944000)
|
79
|
+
# hpricot 6.198000 0.000000 6.198000 ( 6.198000)
|
80
|
+
# jdom_document_builder 1.450000 0.000000 1.450000 ( 1.451000)
|
81
|
+
#
|
82
|
+
# $ jruby -J-server ./xml_benchmarks.rb
|
83
|
+
#
|
84
|
+
# Ruby version: JRuby 1.8.6 (2008-03-20 rev 6255) [i386-jruby1.1RC3], platform: Java: version: 1.5.0_13
|
85
|
+
#
|
86
|
+
# 100 times: Open 98k XML document and count one type of leaf element (466 entries)
|
87
|
+
#
|
88
|
+
# Rehearsal ---------------------------------------------------------
|
89
|
+
# rexml 13.212000 0.000000 13.212000 ( 13.212000)
|
90
|
+
# hpricot 6.992000 0.000000 6.992000 ( 6.993000)
|
91
|
+
# jdom_document_builder 1.873000 0.000000 1.873000 ( 1.873000)
|
92
|
+
# ----------------------------------------------- total: 22.077000sec
|
93
|
+
#
|
94
|
+
# user system total real
|
95
|
+
# rexml 9.611000 0.000000 9.611000 ( 9.609000)
|
96
|
+
# hpricot 3.446000 0.000000 3.446000 ( 3.447000)
|
97
|
+
# jdom_document_builder 0.616000 0.000000 0.616000 ( 0.617000)
|
98
|
+
#
|
99
|
+
#
|
100
|
+
# *** Now using: Java 1.6.0_03 (Soylatte) ***
|
101
|
+
#
|
102
|
+
# $ jruby ./xml_benchmarks.rb
|
103
|
+
#
|
104
|
+
# Ruby version: JRuby 1.8.6 (2008-03-20 rev 6255) [i386-jruby1.1RC3], platform: Java: version: 1.6.0_03-p3
|
105
|
+
#
|
106
|
+
# 100 times: Open 98k XML document and count one type of leaf element (466 entries)
|
107
|
+
#
|
108
|
+
# Rehearsal ---------------------------------------------------------
|
109
|
+
# rexml 9.976000 0.000000 9.976000 ( 9.976000)
|
110
|
+
# hpricot 4.129000 0.000000 4.129000 ( 4.129000)
|
111
|
+
# jdom_document_builder 2.287000 0.000000 2.287000 ( 2.287000)
|
112
|
+
# ----------------------------------------------- total: 16.392000sec
|
113
|
+
#
|
114
|
+
# user system total real
|
115
|
+
# rexml 6.357000 0.000000 6.357000 ( 6.356000)
|
116
|
+
# hpricot 2.274000 0.000000 2.274000 ( 2.273000)
|
117
|
+
# jdom_document_builder 0.363000 0.000000 0.363000 ( 0.363000)
|
118
|
+
#
|
119
|
+
# $ jruby -J-server ./xml_benchmarks.rb
|
120
|
+
#
|
121
|
+
# Ruby version: JRuby 1.8.6 (2008-03-20 rev 6255) [i386-jruby1.1RC3], platform: Java: version: 1.6.0_03-p3
|
122
|
+
#
|
123
|
+
# 100 times: Open 98k XML document and count one type of leaf element (466 entries)
|
124
|
+
#
|
125
|
+
# Rehearsal ---------------------------------------------------------
|
126
|
+
# rexml 9.936000 0.000000 9.936000 ( 9.935000)
|
127
|
+
# hpricot 4.074000 0.000000 4.074000 ( 4.074000)
|
128
|
+
# jdom_document_builder 1.355000 0.000000 1.355000 ( 1.355000)
|
129
|
+
# ----------------------------------------------- total: 15.365000sec
|
130
|
+
#
|
131
|
+
# user system total real
|
132
|
+
# rexml 6.251000 0.000000 6.251000 ( 6.251000)
|
133
|
+
# hpricot 2.273000 0.000000 2.273000 ( 2.272000)
|
134
|
+
# jdom_document_builder 0.412000 0.000000 0.412000 ( 0.412000)
|
135
|
+
#
|
136
|
+
|
137
|
+
require 'benchmark'
|
138
|
+
require "rexml/document"
|
139
|
+
require 'hpricot'
|
140
|
+
|
141
|
+
if RUBY_PLATFORM =~ /java/
|
142
|
+
include Java
|
143
|
+
import javax.xml.parsers.DocumentBuilder
|
144
|
+
import javax.xml.parsers.DocumentBuilderFactory
|
145
|
+
@dbf = DocumentBuilderFactory.new_instance
|
146
|
+
@ruby_info = "Ruby version: JRuby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL}) [i386-jruby#{JRUBY_VERSION}]"
|
147
|
+
@ruby_info << ", platform: Java, version #{java.lang.System.getProperty('java.version')}"
|
148
|
+
else
|
149
|
+
require 'libxml'
|
150
|
+
@xml_parser = XML::Parser.new
|
151
|
+
@ruby_info = "Ruby version: MRI #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"# rev #{RUBY_PATCHLEVEL})"
|
152
|
+
@ruby_info << ", platform: #{RUBY_PLATFORM}"
|
153
|
+
end
|
154
|
+
|
155
|
+
@bundle_with_466_sock_entries = File.read("sock_entries.xml")
|
156
|
+
|
157
|
+
def rexml_count_socks
|
158
|
+
doc = REXML::Document.new(@bundle_with_466_sock_entries).root
|
159
|
+
socks = doc.elements.to_a('./sockEntries').length
|
160
|
+
end
|
161
|
+
|
162
|
+
unless RUBY_PLATFORM =~ /java/
|
163
|
+
def libxml_count_socks
|
164
|
+
@xml_parser.string = @bundle_with_466_sock_entries
|
165
|
+
doc = @xml_parser.parse.root
|
166
|
+
socks = doc.find('//sockEntries').length
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def hpricot_count_socks
|
171
|
+
doc = Hpricot.XML(@bundle_with_466_sock_entries)
|
172
|
+
socks = doc.search("//sockEntries").length
|
173
|
+
end
|
174
|
+
|
175
|
+
if RUBY_PLATFORM =~ /java/
|
176
|
+
def jdom_document_builder_count_socks
|
177
|
+
doc = @dbf.new_document_builder.parse("bundle_with_466_sock_entries.xml").get_document_element
|
178
|
+
socks = doc.getElementsByTagName("sockEntries")
|
179
|
+
socks.get_length
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
n = 100
|
184
|
+
test_iterations = ARGV.first.to_i
|
185
|
+
test_iterations = 1 unless test_iterations > 1
|
186
|
+
puts
|
187
|
+
puts @ruby_info
|
188
|
+
puts
|
189
|
+
puts "#{n} times: Open 98k XML document and count one type of leaf element (466 entries)"
|
190
|
+
puts
|
191
|
+
print "running benchmark "
|
192
|
+
if test_iterations == 1
|
193
|
+
puts "once.\n\n"
|
194
|
+
else
|
195
|
+
puts "#{test_iterations} times.\n\n"
|
196
|
+
end
|
197
|
+
test_iterations.times do
|
198
|
+
Benchmark.bmbm do |x|
|
199
|
+
x.report("libxml") { n.times {libxml_count_socks} } unless RUBY_PLATFORM =~ /java/
|
200
|
+
x.report("hpricot") { n.times {hpricot_count_socks} }
|
201
|
+
x.report("rexml") { n.times {rexml_count_socks} }
|
202
|
+
x.report("jdom_document_builder") { n.times {jdom_document_builder_count_socks} } if RUBY_PLATFORM =~ /java/
|
203
|
+
end
|
204
|
+
puts
|
205
|
+
end
|
206
|
+
|
207
|
+
#
|
208
|
+
# jrexml doesn't appear to have any speedup in this test
|
209
|
+
#
|
210
|
+
# if RUBY_PLATFORM =~ /java/
|
211
|
+
# require 'jrexml'
|
212
|
+
# def rexml_with_jrexml_count_socks
|
213
|
+
# doc = REXML::Document.new(@bundle_with_466_sock_entries).root
|
214
|
+
# socks = doc.elements.to_a('./sockEntries').length
|
215
|
+
# end
|
216
|
+
#
|
217
|
+
# puts "\nNow add in JREXML to see if it speeds up rexml\n"
|
218
|
+
# Benchmark.bmbm do |x|
|
219
|
+
# x.report("rexml+jrexml") { n.times {rexml_with_jrexml_count_socks} }
|
220
|
+
# end
|
221
|
+
# puts
|
222
|
+
# end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: LibXML</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">LibXML</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/ext/libxml/libxml_c.html">
|
59
|
+
ext/libxml/libxml.c
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/ext/libxml/ruby_xml_attr_c.html">
|
63
|
+
ext/libxml/ruby_xml_attr.c
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../files/ext/libxml/ruby_xml_attributes_c.html">
|
67
|
+
ext/libxml/ruby_xml_attributes.c
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../files/ext/libxml/ruby_xml_document_c.html">
|
71
|
+
ext/libxml/ruby_xml_document.c
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../files/ext/libxml/ruby_xml_dtd_c.html">
|
75
|
+
ext/libxml/ruby_xml_dtd.c
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
<a href="../files/ext/libxml/ruby_xml_html_parser_c.html">
|
79
|
+
ext/libxml/ruby_xml_html_parser.c
|
80
|
+
</a>
|
81
|
+
<br />
|
82
|
+
<a href="../files/ext/libxml/ruby_xml_input_cbg_c.html">
|
83
|
+
ext/libxml/ruby_xml_input_cbg.c
|
84
|
+
</a>
|
85
|
+
<br />
|
86
|
+
<a href="../files/ext/libxml/ruby_xml_node_c.html">
|
87
|
+
ext/libxml/ruby_xml_node.c
|
88
|
+
</a>
|
89
|
+
<br />
|
90
|
+
<a href="../files/ext/libxml/ruby_xml_node_set_c.html">
|
91
|
+
ext/libxml/ruby_xml_node_set.c
|
92
|
+
</a>
|
93
|
+
<br />
|
94
|
+
<a href="../files/ext/libxml/ruby_xml_ns_c.html">
|
95
|
+
ext/libxml/ruby_xml_ns.c
|
96
|
+
</a>
|
97
|
+
<br />
|
98
|
+
<a href="../files/ext/libxml/ruby_xml_parser_c.html">
|
99
|
+
ext/libxml/ruby_xml_parser.c
|
100
|
+
</a>
|
101
|
+
<br />
|
102
|
+
<a href="../files/ext/libxml/ruby_xml_parser_context_c.html">
|
103
|
+
ext/libxml/ruby_xml_parser_context.c
|
104
|
+
</a>
|
105
|
+
<br />
|
106
|
+
<a href="../files/ext/libxml/ruby_xml_reader_c.html">
|
107
|
+
ext/libxml/ruby_xml_reader.c
|
108
|
+
</a>
|
109
|
+
<br />
|
110
|
+
<a href="../files/ext/libxml/ruby_xml_sax_parser_c.html">
|
111
|
+
ext/libxml/ruby_xml_sax_parser.c
|
112
|
+
</a>
|
113
|
+
<br />
|
114
|
+
<a href="../files/ext/libxml/ruby_xml_schema_c.html">
|
115
|
+
ext/libxml/ruby_xml_schema.c
|
116
|
+
</a>
|
117
|
+
<br />
|
118
|
+
<a href="../files/ext/libxml/ruby_xml_state_c.html">
|
119
|
+
ext/libxml/ruby_xml_state.c
|
120
|
+
</a>
|
121
|
+
<br />
|
122
|
+
<a href="../files/ext/libxml/ruby_xml_xinclude_c.html">
|
123
|
+
ext/libxml/ruby_xml_xinclude.c
|
124
|
+
</a>
|
125
|
+
<br />
|
126
|
+
<a href="../files/ext/libxml/ruby_xml_xpath_c.html">
|
127
|
+
ext/libxml/ruby_xml_xpath.c
|
128
|
+
</a>
|
129
|
+
<br />
|
130
|
+
<a href="../files/ext/libxml/ruby_xml_xpath_context_c.html">
|
131
|
+
ext/libxml/ruby_xml_xpath_context.c
|
132
|
+
</a>
|
133
|
+
<br />
|
134
|
+
<a href="../files/ext/libxml/ruby_xml_xpath_object_c.html">
|
135
|
+
ext/libxml/ruby_xml_xpath_object.c
|
136
|
+
</a>
|
137
|
+
<br />
|
138
|
+
<a href="../files/ext/libxml/ruby_xml_xpointer_c.html">
|
139
|
+
ext/libxml/ruby_xml_xpointer.c
|
140
|
+
</a>
|
141
|
+
<br />
|
142
|
+
<a href="../files/ext/libxml/ruby_xml_xpointer_context_c.html">
|
143
|
+
ext/libxml/ruby_xml_xpointer_context.c
|
144
|
+
</a>
|
145
|
+
<br />
|
146
|
+
<a href="../files/lib/libxml/attr_rb.html">
|
147
|
+
lib/libxml/attr.rb
|
148
|
+
</a>
|
149
|
+
<br />
|
150
|
+
<a href="../files/lib/libxml/attributes_rb.html">
|
151
|
+
lib/libxml/attributes.rb
|
152
|
+
</a>
|
153
|
+
<br />
|
154
|
+
<a href="../files/lib/libxml/document_rb.html">
|
155
|
+
lib/libxml/document.rb
|
156
|
+
</a>
|
157
|
+
<br />
|
158
|
+
<a href="../files/lib/libxml/node_rb.html">
|
159
|
+
lib/libxml/node.rb
|
160
|
+
</a>
|
161
|
+
<br />
|
162
|
+
<a href="../files/lib/libxml/node_set_rb.html">
|
163
|
+
lib/libxml/node_set.rb
|
164
|
+
</a>
|
165
|
+
<br />
|
166
|
+
<a href="../files/lib/libxml/parser_rb.html">
|
167
|
+
lib/libxml/parser.rb
|
168
|
+
</a>
|
169
|
+
<br />
|
170
|
+
<a href="../files/lib/libxml/parser_options_rb.html">
|
171
|
+
lib/libxml/parser_options.rb
|
172
|
+
</a>
|
173
|
+
<br />
|
174
|
+
<a href="../files/lib/libxml/properties_rb.html">
|
175
|
+
lib/libxml/properties.rb
|
176
|
+
</a>
|
177
|
+
<br />
|
178
|
+
<a href="../files/lib/libxml/tree_rb.html">
|
179
|
+
lib/libxml/tree.rb
|
180
|
+
</a>
|
181
|
+
<br />
|
182
|
+
</td>
|
183
|
+
</tr>
|
184
|
+
|
185
|
+
</table>
|
186
|
+
</div>
|
187
|
+
<!-- banner header -->
|
188
|
+
|
189
|
+
<div id="bodyContent">
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<div id="contextContent">
|
194
|
+
|
195
|
+
<div id="description">
|
196
|
+
<p>
|
197
|
+
This is for backwards compatibility and is DEPRECATED
|
198
|
+
</p>
|
199
|
+
|
200
|
+
</div>
|
201
|
+
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
<!-- if includes -->
|
210
|
+
|
211
|
+
<div id="section">
|
212
|
+
|
213
|
+
<div id="class-list">
|
214
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
215
|
+
|
216
|
+
Module <a href="LibXML/XML.html" class="link">LibXML::XML</a><br />
|
217
|
+
|
218
|
+
</div>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<!-- if method_list -->
|
227
|
+
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
|
232
|
+
<div id="validator-badges">
|
233
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
</body>
|
237
|
+
</html>
|