libxml-ruby 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY +15 -0
- data/README.rdoc +7 -7
- data/Rakefile +80 -78
- data/ext/libxml/extconf.h +4 -0
- data/ext/libxml/extconf.rb +57 -116
- data/ext/libxml/libxml.c +4 -0
- data/ext/libxml/ruby_xml.c +977 -893
- data/ext/libxml/ruby_xml.h +20 -10
- data/ext/libxml/ruby_xml_attr.c +333 -333
- data/ext/libxml/ruby_xml_attr_decl.c +2 -2
- data/ext/libxml/ruby_xml_cbg.c +85 -85
- data/ext/libxml/ruby_xml_document.c +1133 -1147
- data/ext/libxml/ruby_xml_dtd.c +261 -268
- data/ext/libxml/ruby_xml_encoding.c +262 -260
- data/ext/libxml/ruby_xml_encoding.h +19 -19
- data/ext/libxml/ruby_xml_html_parser_context.c +337 -338
- data/ext/libxml/ruby_xml_input_cbg.c +191 -191
- data/ext/libxml/ruby_xml_io.c +52 -50
- data/ext/libxml/ruby_xml_namespace.c +2 -2
- data/ext/libxml/ruby_xml_node.c +1446 -1452
- data/ext/libxml/ruby_xml_parser_context.c +999 -1001
- data/ext/libxml/ruby_xml_reader.c +1226 -1228
- data/ext/libxml/ruby_xml_relaxng.c +110 -111
- data/ext/libxml/ruby_xml_sax2_handler.c +326 -328
- data/ext/libxml/ruby_xml_schema.c +300 -301
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/libxml/ruby_xml_writer.c +14 -15
- data/ext/libxml/ruby_xml_xpath.c +188 -188
- data/ext/libxml/ruby_xml_xpath_context.c +360 -361
- data/ext/libxml/ruby_xml_xpath_object.c +335 -335
- data/libxml-ruby.gemspec +47 -44
- data/test/tc_attr.rb +5 -7
- data/test/tc_attr_decl.rb +5 -6
- data/test/tc_attributes.rb +1 -2
- data/test/tc_canonicalize.rb +1 -2
- data/test/tc_deprecated_require.rb +1 -2
- data/test/tc_document.rb +4 -5
- data/test/tc_document_write.rb +2 -3
- data/test/tc_dtd.rb +4 -5
- data/test/tc_encoding.rb +126 -126
- data/test/tc_encoding_sax.rb +4 -3
- data/test/tc_error.rb +14 -15
- data/test/tc_html_parser.rb +15 -7
- data/test/tc_html_parser_context.rb +1 -2
- data/test/tc_namespace.rb +2 -3
- data/test/tc_namespaces.rb +5 -6
- data/test/tc_node.rb +2 -3
- data/test/tc_node_cdata.rb +2 -3
- data/test/tc_node_comment.rb +1 -2
- data/test/tc_node_copy.rb +1 -2
- data/test/tc_node_edit.rb +5 -7
- data/test/tc_node_pi.rb +1 -2
- data/test/tc_node_text.rb +2 -3
- data/test/tc_node_write.rb +2 -3
- data/test/tc_node_xlink.rb +1 -2
- data/test/tc_parser.rb +18 -24
- data/test/tc_parser_context.rb +6 -7
- data/test/tc_properties.rb +1 -2
- data/test/tc_reader.rb +9 -10
- data/test/tc_relaxng.rb +4 -5
- data/test/tc_sax_parser.rb +9 -10
- data/test/tc_schema.rb +4 -5
- data/test/tc_traversal.rb +1 -2
- data/test/tc_writer.rb +1 -2
- data/test/tc_xinclude.rb +1 -2
- data/test/tc_xml.rb +1 -2
- data/test/tc_xpath.rb +8 -9
- data/test/tc_xpath_context.rb +3 -4
- data/test/tc_xpath_expression.rb +3 -4
- data/test/tc_xpointer.rb +1 -3
- data/test/test_helper.rb +3 -1
- data/test/test_suite.rb +0 -1
- metadata +47 -11
- data/test/etc_doc_to_s.rb +0 -21
- data/test/ets_doc_file.rb +0 -17
- data/test/ets_doc_to_s.rb +0 -23
- data/test/ets_gpx.rb +0 -28
- data/test/ets_node_gc.rb +0 -23
- data/test/ets_test.xml +0 -2
- data/test/ets_tsr.rb +0 -11
data/test/tc_traversal.rb
CHANGED
data/test/tc_writer.rb
CHANGED
data/test/tc_xinclude.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require './test_helper'
|
4
|
-
require 'test/unit'
|
5
4
|
|
6
|
-
class TestXInclude < Test
|
5
|
+
class TestXInclude < Minitest::Test
|
7
6
|
def setup
|
8
7
|
@doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/xinclude.xml'))
|
9
8
|
assert_instance_of(XML::Document, @doc)
|
data/test/tc_xml.rb
CHANGED
data/test/tc_xpath.rb
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
require './test_helper'
|
4
4
|
require 'tempfile'
|
5
|
-
require 'test/unit'
|
6
5
|
|
7
|
-
class TestXPath < Test
|
6
|
+
class TestXPath < Minitest::Test
|
8
7
|
def setup
|
9
8
|
@doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
|
10
9
|
end
|
@@ -109,17 +108,17 @@ class TestXPath < Test::Unit::TestCase
|
|
109
108
|
doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/atom.xml'))
|
110
109
|
|
111
110
|
# No namespace has been yet defined
|
112
|
-
|
111
|
+
assert_raises(XML::Error) do
|
113
112
|
node = doc.find("atom:title")
|
114
113
|
end
|
115
114
|
|
116
115
|
node = doc.find('atom:title', 'atom:http://www.w3.org/2005/Atom')
|
117
|
-
|
116
|
+
refute_nil(node)
|
118
117
|
|
119
118
|
# Register namespace
|
120
119
|
doc.root.namespaces.default_prefix = 'atom'
|
121
120
|
node = doc.find("atom:title")
|
122
|
-
|
121
|
+
refute_nil(node)
|
123
122
|
end
|
124
123
|
|
125
124
|
def test_node_find
|
@@ -145,7 +144,7 @@ class TestXPath < Test::Unit::TestCase
|
|
145
144
|
|
146
145
|
def test_node_no_doc
|
147
146
|
node = XML::Node.new('header', 'some content')
|
148
|
-
|
147
|
+
assert_raises(TypeError) do
|
149
148
|
node = node.find_first('/header')
|
150
149
|
end
|
151
150
|
end
|
@@ -201,20 +200,20 @@ class TestXPath < Test::Unit::TestCase
|
|
201
200
|
def test_xpath_empty_result
|
202
201
|
doc = XML::Document.string('<html><body><p>Welcome to XHTML land!</p></body></html>')
|
203
202
|
nodes = doc.find("//object/param[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'wmode']")
|
204
|
-
|
203
|
+
refute_nil nodes
|
205
204
|
end
|
206
205
|
|
207
206
|
def test_invalid_expression
|
208
207
|
xml = LibXML::XML::Document.string('<a></a>')
|
209
208
|
|
210
209
|
# Using the expression twice used to cause a Segmentation Fault
|
211
|
-
error =
|
210
|
+
error = assert_raises(XML::Error) do
|
212
211
|
xml.find('//a/')
|
213
212
|
end
|
214
213
|
assert_equal("Error: Invalid expression.", error.to_s)
|
215
214
|
|
216
215
|
# Try again - this used to cause a Segmentation Fault
|
217
|
-
error =
|
216
|
+
error = assert_raises(XML::Error) do
|
218
217
|
xml.find('//a/')
|
219
218
|
end
|
220
219
|
assert_equal("Error: Invalid expression.", error.to_s)
|
data/test/tc_xpath_context.rb
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
require './test_helper'
|
4
4
|
require "tempfile"
|
5
|
-
require "test/unit"
|
6
5
|
|
7
|
-
class TestXPathContext < Test
|
6
|
+
class TestXPathContext < Minitest::Test
|
8
7
|
SOAP_PREFIX = 'soap'
|
9
8
|
SOAP_URI = 'http://schemas.xmlsoap.org/soap/envelope/'
|
10
9
|
|
@@ -21,7 +20,7 @@ class TestXPathContext < Test::Unit::TestCase
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def test_no_ns
|
24
|
-
error =
|
23
|
+
error = assert_raises(LibXML::XML::Error) do
|
25
24
|
@context.find('/soap:Envelope')
|
26
25
|
end
|
27
26
|
assert_equal("Error: Undefined namespace prefix.", error.to_s)
|
@@ -81,7 +80,7 @@ class TestXPathContext < Test::Unit::TestCase
|
|
81
80
|
|
82
81
|
def test_require_doc
|
83
82
|
doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
|
84
|
-
error =
|
83
|
+
error = assert_raises(TypeError) do
|
85
84
|
@context = XML::XPath::Context.new(doc.root)
|
86
85
|
end
|
87
86
|
assert_equal("Supplied argument must be a document or node.", error.to_s)
|
data/test/tc_xpath_expression.rb
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
require './test_helper'
|
4
4
|
|
5
|
-
require 'test/unit'
|
6
5
|
|
7
|
-
class TestXPathExpression < Test
|
6
|
+
class TestXPathExpression < Minitest::Test
|
8
7
|
def setup
|
9
8
|
xp = XML::Parser.string('<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>')
|
10
9
|
@doc = xp.parse
|
@@ -29,10 +28,10 @@ class TestXPathExpression < Test::Unit::TestCase
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def test_find_invalid
|
32
|
-
error =
|
31
|
+
error = assert_raises(TypeError) do
|
33
32
|
set = @doc.find(999)
|
34
33
|
end
|
35
|
-
assert_equal('Argument should be an
|
34
|
+
assert_equal('Argument should be an instance of a String or XPath::Expression',
|
36
35
|
error.to_s)
|
37
36
|
end
|
38
37
|
end
|
data/test/tc_xpointer.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
|
3
2
|
require './test_helper'
|
4
|
-
require "test/unit"
|
5
3
|
|
6
|
-
class TC_XML_XPointer < Test
|
4
|
+
class TC_XML_XPointer < Minitest::Test
|
7
5
|
def setup()
|
8
6
|
xp = XML::Parser.string('<!DOCTYPE ra [<!ELEMENT ra (foo+)><!ATTLIST ra id ID #IMPLIED><!ELEMENT foo (#PCDATA)><!ATTLIST foo id ID #IMPLIED>]><ra id="start"><foo id="one">one</foo><foo id="two">two</foo><foo id="three">three</foo></ra>')
|
9
7
|
@doc = xp.parse
|
data/test/test_helper.rb
CHANGED
data/test/test_suite.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libxml-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamform
|
@@ -14,8 +14,50 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
18
|
-
dependencies:
|
17
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: hanna_guado
|
21
|
+
requirement: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '0'
|
26
|
+
type: :development
|
27
|
+
prerelease: false
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake-compiler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
19
61
|
description: |2
|
20
62
|
The Libxml-Ruby project provides Ruby language bindings for the GNOME
|
21
63
|
Libxml2 XML toolkit. It is free software, released under the MIT License.
|
@@ -33,6 +75,7 @@ files:
|
|
33
75
|
- MANIFEST
|
34
76
|
- README.rdoc
|
35
77
|
- Rakefile
|
78
|
+
- ext/libxml/extconf.h
|
36
79
|
- ext/libxml/extconf.rb
|
37
80
|
- ext/libxml/libxml.c
|
38
81
|
- ext/libxml/libxml_ruby.def
|
@@ -176,13 +219,6 @@ files:
|
|
176
219
|
- test/c14n/result/without-comments/example-5
|
177
220
|
- test/c14n/result/without-comments/example-6
|
178
221
|
- test/c14n/result/without-comments/example-7
|
179
|
-
- test/etc_doc_to_s.rb
|
180
|
-
- test/ets_doc_file.rb
|
181
|
-
- test/ets_doc_to_s.rb
|
182
|
-
- test/ets_gpx.rb
|
183
|
-
- test/ets_node_gc.rb
|
184
|
-
- test/ets_test.xml
|
185
|
-
- test/ets_tsr.rb
|
186
222
|
- test/model/atom.xml
|
187
223
|
- test/model/bands.iso-8859-1.xml
|
188
224
|
- test/model/bands.utf-8.xml
|
@@ -259,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
295
|
version: '0'
|
260
296
|
requirements: []
|
261
297
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.
|
298
|
+
rubygems_version: 2.5.1
|
263
299
|
signing_key:
|
264
300
|
specification_version: 4
|
265
301
|
summary: Ruby Bindings for LibXML2
|
data/test/etc_doc_to_s.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require './test_helper'
|
4
|
-
|
5
|
-
1.times do |count|
|
6
|
-
|
7
|
-
xml_doc = XML::Document.new()
|
8
|
-
xml_doc.encoding = "UTF-8"
|
9
|
-
xml_doc.root = XML::Node.new("Request")
|
10
|
-
|
11
|
-
1000.times do |index|
|
12
|
-
xml_doc.root << node = XML::Node.new("row")
|
13
|
-
node["user_id"] = index.to_s
|
14
|
-
node << "600445"
|
15
|
-
end
|
16
|
-
|
17
|
-
xml_str = xml_doc.to_s
|
18
|
-
print "\r#{count}"
|
19
|
-
$stdout.flush
|
20
|
-
end
|
21
|
-
puts "\n"
|
data/test/ets_doc_file.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require './test_helper'
|
4
|
-
|
5
|
-
# This is related to bug 8337, complaint is on amd64/fbsd
|
6
|
-
# unknown if it happens on other amd64/os combos
|
7
|
-
|
8
|
-
Process.setrlimit(Process::RLIMIT_NOFILE,10005)
|
9
|
-
|
10
|
-
(1..10000).each{|time|
|
11
|
-
XML::Document.file(File.join(File.dirname(__FILE__),'ets_test.xml'))
|
12
|
-
if time % 100 == 0
|
13
|
-
print "\r#{time}"
|
14
|
-
$stdout.flush
|
15
|
-
end
|
16
|
-
}
|
17
|
-
puts "\n"
|
data/test/ets_doc_to_s.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require './test_helper'
|
4
|
-
|
5
|
-
100.times do |count|
|
6
|
-
|
7
|
-
xml_doc = XML::Document.new()
|
8
|
-
xml_doc.encoding = "UTF-8"
|
9
|
-
xml_doc.root = XML::Node.new("Request")
|
10
|
-
|
11
|
-
1000.times do |index|
|
12
|
-
|
13
|
-
xml_doc.root << node = XML::Node.new("row")
|
14
|
-
node["user_id"] = index.to_s
|
15
|
-
node << "600445"
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
xml_str = xml_doc.to_s
|
20
|
-
print "\r#{count}"
|
21
|
-
$stdout.flush
|
22
|
-
end
|
23
|
-
puts "\n"
|
data/test/ets_gpx.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require 'libxml'
|
4
|
-
|
5
|
-
100.times do
|
6
|
-
doc = XML::Document.new
|
7
|
-
doc.encoding = 'UTF-8'
|
8
|
-
|
9
|
-
root = XML::Node.new 'gpx'
|
10
|
-
root['version'] = '1.0'
|
11
|
-
root['creator'] = 'OpenStreetMap.org'
|
12
|
-
root['xmlns'] = "http://www.topografix.com/GPX/1/0/"
|
13
|
-
|
14
|
-
doc.root = root
|
15
|
-
|
16
|
-
track = XML::Node.new 'trk'
|
17
|
-
doc.root << track
|
18
|
-
|
19
|
-
trkseg = XML::Node.new 'trkseg'
|
20
|
-
track << trkseg
|
21
|
-
|
22
|
-
1.upto(1000) do |n|
|
23
|
-
trkpt = XML::Node.new 'trkpt'
|
24
|
-
trkpt['lat'] = n.to_s
|
25
|
-
trkpt['lon'] = n.to_s
|
26
|
-
trkseg << trkpt
|
27
|
-
end
|
28
|
-
end
|
data/test/ets_node_gc.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require './test_helper'
|
4
|
-
|
5
|
-
# test of bug 13310, clears MEM2
|
6
|
-
|
7
|
-
include GC
|
8
|
-
|
9
|
-
inner = XML::Node.new('inner')
|
10
|
-
save = nil
|
11
|
-
1.times do
|
12
|
-
outer = XML::Node.new('outer')
|
13
|
-
outer.child = inner
|
14
|
-
1.times do
|
15
|
-
doc = XML::Document.new
|
16
|
-
doc.root = outer
|
17
|
-
# Uncomment the following line and it won't crash
|
18
|
-
save = doc
|
19
|
-
end
|
20
|
-
garbage_collect
|
21
|
-
end
|
22
|
-
garbage_collect
|
23
|
-
puts inner
|
data/test/ets_test.xml
DELETED