libxml-ruby 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY +8 -0
- data/ext/libxml/extconf.h +3 -0
- data/ext/libxml/extconf.rb +30 -26
- data/ext/libxml/ruby_libxml.h +0 -8
- data/ext/libxml/ruby_xml.c +40 -0
- data/ext/libxml/ruby_xml_document.c +1 -1
- data/ext/libxml/ruby_xml_dtd.c +6 -8
- data/ext/libxml/ruby_xml_node.c +1 -1
- data/ext/libxml/ruby_xml_parser_context.c +1 -1
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/lib/libxml-ruby.rb +30 -0
- data/lib/libxml.rb +3 -28
- data/libxml-ruby.gemspec +2 -2
- data/test/test_attr.rb +18 -18
- data/test/test_attr_decl.rb +8 -8
- data/test/test_attributes.rb +10 -10
- data/test/test_canonicalize.rb +16 -24
- data/test/test_deprecated_require.rb +3 -3
- data/test/test_document.rb +118 -112
- data/test/test_document_write.rb +39 -88
- data/test/test_dtd.rb +23 -23
- data/test/test_encoding.rb +15 -15
- data/test/test_encoding_sax.rb +3 -3
- data/test/test_error.rb +51 -51
- data/test/test_helper.rb +2 -9
- data/test/test_html_parser.rb +30 -30
- data/test/test_html_parser_context.rb +6 -6
- data/test/test_namespace.rb +16 -16
- data/test/test_namespaces.rb +25 -25
- data/test/test_node.rb +36 -30
- data/test/test_node_cdata.rb +10 -10
- data/test/test_node_comment.rb +6 -6
- data/test/test_node_copy.rb +2 -2
- data/test/test_node_edit.rb +16 -16
- data/test/test_node_pi.rb +7 -7
- data/test/test_node_text.rb +6 -6
- data/test/test_node_write.rb +16 -26
- data/test/test_node_xlink.rb +6 -6
- data/test/test_parser.rb +68 -72
- data/test/test_parser_context.rb +28 -28
- data/test/test_properties.rb +5 -5
- data/test/test_reader.rb +80 -85
- data/test/test_relaxng.rb +11 -11
- data/test/test_sax_parser.rb +28 -28
- data/test/test_schema.rb +24 -24
- data/test/test_suite.rb +3 -4
- data/test/test_traversal.rb +4 -4
- data/test/test_writer.rb +50 -52
- data/test/test_xinclude.rb +3 -3
- data/test/test_xml.rb +114 -102
- data/test/test_xpath.rb +22 -22
- data/test/test_xpath_context.rb +5 -5
- data/test/test_xpath_expression.rb +6 -6
- data/test/test_xpointer.rb +15 -15
- metadata +6 -5
data/test/test_xpath_context.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
|
3
|
+
require_relative './test_helper'
|
4
4
|
require "tempfile"
|
5
5
|
|
6
6
|
class TestXPathContext < Minitest::Test
|
@@ -11,8 +11,8 @@ class TestXPathContext < Minitest::Test
|
|
11
11
|
NS0_URI = 'http://services.somewhere.com'
|
12
12
|
|
13
13
|
def setup
|
14
|
-
doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
|
15
|
-
@context = XML::XPath::Context.new(doc)
|
14
|
+
doc = LibXML::XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
|
15
|
+
@context = LibXML::XML::XPath::Context.new(doc)
|
16
16
|
end
|
17
17
|
|
18
18
|
def teardown()
|
@@ -79,9 +79,9 @@ class TestXPathContext < Minitest::Test
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_require_doc
|
82
|
-
doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
|
82
|
+
doc = LibXML::XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
|
83
83
|
error = assert_raises(TypeError) do
|
84
|
-
@context = XML::XPath::Context.new(doc.root)
|
84
|
+
@context = LibXML::XML::XPath::Context.new(doc.root)
|
85
85
|
end
|
86
86
|
assert_equal("Supplied argument must be a document or node.", error.to_s)
|
87
87
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
|
3
|
+
require_relative './test_helper'
|
4
4
|
|
5
5
|
|
6
6
|
class TestXPathExpression < Minitest::Test
|
7
7
|
def setup
|
8
|
-
xp = XML::Parser.string('<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>')
|
8
|
+
xp = LibXML::XML::Parser.string('<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>')
|
9
9
|
@doc = xp.parse
|
10
10
|
end
|
11
11
|
|
@@ -14,16 +14,16 @@ class TestXPathExpression < Minitest::Test
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_nodes
|
17
|
-
expr = XML::XPath::Expression.compile('/ruby_array/fixnum')
|
17
|
+
expr = LibXML::XML::XPath::Expression.compile('/ruby_array/fixnum')
|
18
18
|
set = @doc.find(expr)
|
19
|
-
assert_instance_of(XML::XPath::Object, set)
|
19
|
+
assert_instance_of(LibXML::XML::XPath::Object, set)
|
20
20
|
assert_equal(2, set.size)
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_find_class
|
24
|
-
expr = XML::XPath::Expression.new('/ruby_array/fixnum')
|
24
|
+
expr = LibXML::XML::XPath::Expression.new('/ruby_array/fixnum')
|
25
25
|
set = @doc.find(expr)
|
26
|
-
assert_instance_of(XML::XPath::Object, set)
|
26
|
+
assert_instance_of(LibXML::XML::XPath::Object, set)
|
27
27
|
assert_equal(2, set.size)
|
28
28
|
end
|
29
29
|
|
data/test/test_xpointer.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
|
2
|
+
require_relative './test_helper'
|
3
3
|
|
4
4
|
class TC_XML_XPointer < Minitest::Test
|
5
5
|
def setup()
|
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>')
|
6
|
+
xp = LibXML::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>')
|
7
7
|
@doc = xp.parse
|
8
|
-
assert_instance_of(XML::Document, @doc)
|
8
|
+
assert_instance_of(LibXML::XML::Document, @doc)
|
9
9
|
@root = @doc.root
|
10
|
-
assert_instance_of(XML::Node, @root)
|
10
|
+
assert_instance_of(LibXML::XML::Node, @root)
|
11
11
|
end
|
12
12
|
|
13
13
|
def teardown()
|
@@ -18,20 +18,20 @@ class TC_XML_XPointer < Minitest::Test
|
|
18
18
|
|
19
19
|
def test_libxml_xpointer_id
|
20
20
|
xptr = @root.pointer('xpointer(id("two"))')
|
21
|
-
assert_instance_of(XML::XPath::Object, xptr)
|
21
|
+
assert_instance_of(LibXML::XML::XPath::Object, xptr)
|
22
22
|
xptr.each do |node|
|
23
23
|
# It seems from the spec that the pointer should
|
24
24
|
# be the whole node, rather than just the ID attr.
|
25
25
|
assert_equal('two', node.content)
|
26
|
-
assert_instance_of(XML::Node, node)
|
26
|
+
assert_instance_of(LibXML::XML::Node, node)
|
27
27
|
assert_equal('two', node['id'])
|
28
28
|
end
|
29
29
|
|
30
30
|
# FIXME: Not sure at all about this kind of range
|
31
31
|
if ENV['NOTWORKING']
|
32
32
|
@xptr = @root.pointer('xpointer(id("two")) xpointer(id("three"))')
|
33
|
-
assert_instance_of(XML::XPath, @xptr)
|
34
|
-
assert_instance_of(XML::Node::Set, @xptr.set)
|
33
|
+
assert_instance_of(LibXML::XML::XPath, @xptr)
|
34
|
+
assert_instance_of(LibXML::XML::Node::Set, @xptr.set)
|
35
35
|
assert_equal(2, @xptr.set.length)
|
36
36
|
for n in @xptr.set
|
37
37
|
assert_match(/two|three/, n.to_s)
|
@@ -45,13 +45,13 @@ class TC_XML_XPointer < Minitest::Test
|
|
45
45
|
nstart = nend = nil
|
46
46
|
@xptr = @root.pointer('xpointer(id("one"))').set
|
47
47
|
@xptr.each{|n| nstart = n}
|
48
|
-
assert_instance_of(XML::Node, nstart)
|
48
|
+
assert_instance_of(LibXML::XML::Node, nstart)
|
49
49
|
@xptr = @root.pointer('xpointer(id("three"))').set
|
50
50
|
@xptr.each{|n| nend = n}
|
51
|
-
assert_instance_of(XML::Node, nend)
|
52
|
-
range = XML::XPointer.range(nstart, nend)
|
53
|
-
assert_instance_of(XML::XPath, range)
|
54
|
-
assert_instance_of(XML::Node::Set, range.set)
|
51
|
+
assert_instance_of(LibXML::XML::Node, nend)
|
52
|
+
range = LibXML::XML::XPointer.range(nstart, nend)
|
53
|
+
assert_instance_of(LibXML::XML::XPath, range)
|
54
|
+
assert_instance_of(LibXML::XML::Node::Set, range.set)
|
55
55
|
|
56
56
|
for n in range.set
|
57
57
|
assert_match(/one|two|three/, n.to_s)
|
@@ -62,9 +62,9 @@ class TC_XML_XPointer < Minitest::Test
|
|
62
62
|
|
63
63
|
# def test_libxml_xpointer_start_point()
|
64
64
|
# @xptr = @root.pointer('xpointer(start-point("one"))')
|
65
|
-
# assert_instance_of(XML::XPath, @xptr)
|
65
|
+
# assert_instance_of(LibXML::XML::XPath, @xptr)
|
66
66
|
# set = @xptr.set
|
67
|
-
# assert_instance_of(XML::Node::Set, set)
|
67
|
+
# assert_instance_of(LibXML::XML::Node::Set, set)
|
68
68
|
# for n in set
|
69
69
|
# assert_match(/one|two|three/, n.to_s)
|
70
70
|
# end
|
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: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Bamform
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rake-compiler
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- MANIFEST
|
62
62
|
- README.rdoc
|
63
63
|
- Rakefile
|
64
|
+
- ext/libxml/extconf.h
|
64
65
|
- ext/libxml/extconf.rb
|
65
66
|
- ext/libxml/libxml.c
|
66
67
|
- ext/libxml/libxml_ruby.def
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- ext/libxml/ruby_xml_xpointer.c
|
139
140
|
- ext/libxml/ruby_xml_xpointer.h
|
140
141
|
- ext/vc/libxml_ruby.sln
|
142
|
+
- lib/libxml-ruby.rb
|
141
143
|
- lib/libxml.rb
|
142
144
|
- lib/libxml/attr.rb
|
143
145
|
- lib/libxml/attr_decl.rb
|
@@ -269,15 +271,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
271
|
requirements:
|
270
272
|
- - ">="
|
271
273
|
- !ruby/object:Gem::Version
|
272
|
-
version:
|
274
|
+
version: '2.5'
|
273
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
276
|
requirements:
|
275
277
|
- - ">="
|
276
278
|
- !ruby/object:Gem::Version
|
277
279
|
version: '0'
|
278
280
|
requirements: []
|
279
|
-
|
280
|
-
rubygems_version: 2.7.3
|
281
|
+
rubygems_version: 3.1.2
|
281
282
|
signing_key:
|
282
283
|
specification_version: 4
|
283
284
|
summary: Ruby Bindings for LibXML2
|