libxml-ruby 3.1.0-x64-mingw32 → 3.2.0-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/2.7/libxml_ruby.so +0 -0
- 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 +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94c7fe73c157183aa88e339ad02d65873cf4fb855223963445c160bbbff0be78
|
4
|
+
data.tar.gz: c29cbebb5708cc8237df324149328df4574db8b1351c02039015362c983d89cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0593491ff9729607c66966147192749392c11f4d200fe23e8a543cdaaa45daf924fde2c04dfe6ab9b8be3cf40810f4731a7864c7ee27b44a528edc36f8c26178'
|
7
|
+
data.tar.gz: d6d66bdbc69ddf104d70611b5254f25f08a188423c9667aaf9a925a862118d386345732876459e15eb9986a03201169bd0212f44bd1d6762de4d0b5a6cbc6c43
|
data/HISTORY
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 3.2.0 / 2020-05-09 Charlie Savage
|
4
|
+
|
5
|
+
* Fix crash when creating an empty DTD
|
6
|
+
* Modernize tests to use Bundler to load gem
|
7
|
+
* Add libxml-ruby.rb file so gem loads in expted way.
|
8
|
+
* Add support for xmlSaveNoEmptyTags.
|
9
|
+
* Clean up extconf.rb file
|
10
|
+
|
3
11
|
== 3.1.0 / 2018-02-03 Charlie Savage
|
4
12
|
|
5
13
|
* Fix segmentation fault when adding one node to another node (Charlie Savage)
|
data/ext/libxml/extconf.rb
CHANGED
@@ -25,33 +25,37 @@ else
|
|
25
25
|
dir_config('xml2')
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
28
|
+
found_header = find_header('libxml/xmlversion.h',
|
29
|
+
'/opt/include/libxml2',
|
30
|
+
'/opt/local/include/libxml2',
|
31
|
+
'/usr/local/include/libxml2',
|
32
|
+
'/usr/include/libxml2',
|
33
|
+
'/usr/local/include')
|
34
|
+
|
35
|
+
found_lib = find_library('xml2', 'xmlParseDoc',
|
36
|
+
'/opt/lib',
|
37
|
+
'/opt/local/lib',
|
38
|
+
'/usr/local/lib',
|
39
|
+
'/usr/lib')
|
40
|
+
|
41
|
+
found_lib ||= find_library('libxml2', 'xmlParseDoc',
|
42
|
+
'/opt/lib',
|
43
|
+
'/opt/local/lib',
|
44
|
+
'/usr/local/lib',
|
45
|
+
'/usr/lib')
|
46
|
+
|
47
|
+
if !found_header || !found_lib
|
48
|
+
crash(<<~EOL)
|
49
|
+
Cannot find libxml2.
|
50
|
+
|
51
|
+
Install the library or try one of the following options to extconf.rb:
|
52
|
+
|
53
|
+
--with-xml2-config=/path/to/xml2-config
|
54
|
+
--with-xml2-dir=/path/to/libxml2
|
55
|
+
--with-xml2-lib=/path/to/libxml2/lib
|
56
|
+
--with-xml2-include=/path/to/libxml2/include
|
57
|
+
EOL
|
48
58
|
end
|
49
59
|
|
50
|
-
have_func('rb_io_bufwrite', 'ruby/io.h')
|
51
|
-
|
52
|
-
# For FreeBSD add /usr/local/include
|
53
|
-
$INCFLAGS << " -I/usr/local/include"
|
54
|
-
$CFLAGS << ' ' << $INCFLAGS
|
55
|
-
|
56
60
|
create_header()
|
57
61
|
create_makefile('libxml_ruby')
|
data/ext/libxml/ruby_libxml.h
CHANGED
@@ -16,15 +16,7 @@
|
|
16
16
|
#include <libxml/xmlreader.h>
|
17
17
|
#include <libxml/c14n.h>
|
18
18
|
|
19
|
-
/* Needed prior to Ruby 1.9.1 */
|
20
|
-
#ifndef RHASH_TBL
|
21
|
-
#define RHASH_TBL(s) (RHASH(s)->tbl)
|
22
|
-
#endif
|
23
|
-
|
24
|
-
// Encoding support added in Ruby 1.9.*
|
25
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
26
19
|
#include <ruby/encoding.h>
|
27
|
-
#endif
|
28
20
|
|
29
21
|
#ifdef LIBXML_DEBUG_ENABLED
|
30
22
|
#include <libxml/xpathInternals.h>
|
data/ext/libxml/ruby_xml.c
CHANGED
@@ -717,6 +717,44 @@ static VALUE rxml_default_compression_set(VALUE klass, VALUE num)
|
|
717
717
|
#endif
|
718
718
|
}
|
719
719
|
|
720
|
+
/*
|
721
|
+
* call-seq:
|
722
|
+
* XML.default_save_no_empty_tags -> (true|false)
|
723
|
+
*
|
724
|
+
* Determine whether serializer outputs empty tags by default.
|
725
|
+
*/
|
726
|
+
static VALUE rxml_default_save_no_empty_tags_get(VALUE klass)
|
727
|
+
{
|
728
|
+
if (xmlSaveNoEmptyTags)
|
729
|
+
return (Qtrue);
|
730
|
+
else
|
731
|
+
return (Qfalse);
|
732
|
+
}
|
733
|
+
|
734
|
+
/*
|
735
|
+
* call-seq:
|
736
|
+
* XML.default_save_no_empty_tags = true|false
|
737
|
+
*
|
738
|
+
* Controls whether serializer outputs empty tags by default.
|
739
|
+
*/
|
740
|
+
static VALUE rxml_default_save_no_empty_tags_set(VALUE klass, VALUE value)
|
741
|
+
{
|
742
|
+
if (value == Qfalse)
|
743
|
+
{
|
744
|
+
xmlSaveNoEmptyTags = 0;
|
745
|
+
return (Qfalse);
|
746
|
+
}
|
747
|
+
else if (value == Qtrue)
|
748
|
+
{
|
749
|
+
xmlSaveNoEmptyTags = 1;
|
750
|
+
return (Qtrue);
|
751
|
+
}
|
752
|
+
else
|
753
|
+
{
|
754
|
+
rb_raise(rb_eArgError, "Invalid argument, must be a boolean");
|
755
|
+
}
|
756
|
+
}
|
757
|
+
|
720
758
|
/*
|
721
759
|
* call-seq:
|
722
760
|
* XML.features -> ["feature", ..., "feature"]
|
@@ -885,6 +923,8 @@ void rxml_init_xml(void)
|
|
885
923
|
rb_define_module_function(mXML, "default_validity_checking=", rxml_default_validity_checking_set, 1);
|
886
924
|
rb_define_module_function(mXML, "default_warnings", rxml_default_warnings_get, 0);
|
887
925
|
rb_define_module_function(mXML, "default_warnings=", rxml_default_warnings_set, 1);
|
926
|
+
rb_define_module_function(mXML, "default_save_no_empty_tags", rxml_default_save_no_empty_tags_get, 0);
|
927
|
+
rb_define_module_function(mXML, "default_save_no_empty_tags=", rxml_default_save_no_empty_tags_set, 1);
|
888
928
|
rb_define_module_function(mXML, "features", rxml_features, 0);
|
889
929
|
rb_define_module_function(mXML, "indent_tree_output", rxml_indent_tree_output_get, 0);
|
890
930
|
rb_define_module_function(mXML, "indent_tree_output=", rxml_indent_tree_output_set, 1);
|
@@ -738,7 +738,7 @@ static VALUE rxml_document_root_set(VALUE self, VALUE node)
|
|
738
738
|
Data_Get_Struct(node, xmlNode, xnode);
|
739
739
|
|
740
740
|
if (xnode->doc != NULL && xnode->doc != xdoc)
|
741
|
-
rb_raise(eXMLError, "Nodes belong to different documents. You must first import the node by calling XML::Document.import");
|
741
|
+
rb_raise(eXMLError, "Nodes belong to different documents. You must first import the node by calling LibXML::XML::Document.import");
|
742
742
|
|
743
743
|
xmlDocSetRootElement(xdoc, xnode);
|
744
744
|
|
data/ext/libxml/ruby_xml_dtd.c
CHANGED
@@ -38,13 +38,11 @@ void rxml_dtd_free(xmlDtdPtr xdtd)
|
|
38
38
|
|
39
39
|
void rxml_dtd_mark(xmlDtdPtr xdtd)
|
40
40
|
{
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
doc = (VALUE)xdtd->doc->_private;
|
47
|
-
rb_gc_mark(doc);
|
41
|
+
if (xdtd && xdtd->doc)
|
42
|
+
{
|
43
|
+
VALUE doc = (VALUE)xdtd->doc->_private;
|
44
|
+
rb_gc_mark(doc);
|
45
|
+
}
|
48
46
|
}
|
49
47
|
|
50
48
|
static VALUE rxml_dtd_alloc(VALUE klass)
|
@@ -173,7 +171,7 @@ static VALUE rxml_dtd_initialize(int argc, VALUE *argv, VALUE self)
|
|
173
171
|
}
|
174
172
|
if (doc != Qnil) {
|
175
173
|
if (rb_obj_is_kind_of(doc, cXMLDocument) == Qfalse)
|
176
|
-
rb_raise(rb_eTypeError, "Must pass an XML::Document object");
|
174
|
+
rb_raise(rb_eTypeError, "Must pass an LibXML::XML::Document object");
|
177
175
|
Data_Get_Struct(doc, xmlDoc, xdoc);
|
178
176
|
}
|
179
177
|
|
data/ext/libxml/ruby_xml_node.c
CHANGED
@@ -310,7 +310,7 @@ static VALUE rxml_node_modify_dom(VALUE self, VALUE target,
|
|
310
310
|
xtarget = rxml_get_xnode(target);
|
311
311
|
|
312
312
|
if (xtarget->doc != NULL && xtarget->doc != xnode->doc)
|
313
|
-
rb_raise(eXMLError, "Nodes belong to different documents. You must first import the node by calling XML::Document.import");
|
313
|
+
rb_raise(eXMLError, "Nodes belong to different documents. You must first import the node by calling LibXML::XML::Document.import");
|
314
314
|
|
315
315
|
xmlUnlinkNode(xtarget);
|
316
316
|
|
@@ -47,7 +47,7 @@ static VALUE rxml_parser_context_document(VALUE klass, VALUE document)
|
|
47
47
|
int length;
|
48
48
|
|
49
49
|
if (rb_obj_is_kind_of(document, cXMLDocument) == Qfalse)
|
50
|
-
rb_raise(rb_eTypeError, "Must pass an XML::Document object");
|
50
|
+
rb_raise(rb_eTypeError, "Must pass an LibXML::XML::Document object");
|
51
51
|
|
52
52
|
Data_Get_Struct(document, xmlDoc, xdoc);
|
53
53
|
xmlDocDumpFormatMemoryEnc(xdoc, &buffer, &length, (const char*)xdoc->encoding, 0);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/* Don't nuke this block! It is used for automatically updating the
|
2
2
|
* versions below. VERSION = string formatting, VERNUM = numbered
|
3
3
|
* version for inline testing: increment both or none at all.*/
|
4
|
-
#define RUBY_LIBXML_VERSION "3.
|
5
|
-
#define RUBY_LIBXML_VERNUM
|
4
|
+
#define RUBY_LIBXML_VERSION "3.2.0"
|
5
|
+
#define RUBY_LIBXML_VERNUM 320
|
6
6
|
#define RUBY_LIBXML_VER_MAJ 3
|
7
|
-
#define RUBY_LIBXML_VER_MIN
|
7
|
+
#define RUBY_LIBXML_VER_MIN 2
|
8
8
|
#define RUBY_LIBXML_VER_MIC 0
|
9
9
|
#define RUBY_LIBXML_VER_PATCH 0
|
Binary file
|
data/lib/libxml-ruby.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Load the C-based binding.
|
4
|
+
begin
|
5
|
+
RUBY_VERSION =~ /(\d+.\d+)/
|
6
|
+
require "#{$1}/libxml_ruby"
|
7
|
+
rescue LoadError
|
8
|
+
require "libxml_ruby"
|
9
|
+
end
|
10
|
+
|
11
|
+
# Load Ruby supporting code.
|
12
|
+
require 'libxml/error'
|
13
|
+
require 'libxml/parser'
|
14
|
+
require 'libxml/document'
|
15
|
+
require 'libxml/namespaces'
|
16
|
+
require 'libxml/namespace'
|
17
|
+
require 'libxml/node'
|
18
|
+
require 'libxml/attributes'
|
19
|
+
require 'libxml/attr'
|
20
|
+
require 'libxml/attr_decl'
|
21
|
+
require 'libxml/tree'
|
22
|
+
require 'libxml/html_parser'
|
23
|
+
require 'libxml/sax_parser'
|
24
|
+
require 'libxml/sax_callbacks'
|
25
|
+
|
26
|
+
#Schema Interface
|
27
|
+
require 'libxml/schema'
|
28
|
+
require 'libxml/schema/type'
|
29
|
+
require 'libxml/schema/element'
|
30
|
+
require 'libxml/schema/attribute'
|
data/lib/libxml.rb
CHANGED
@@ -1,30 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# This include is deprecated, use libxml-ruby instead!
|
2
4
|
|
3
|
-
|
4
|
-
begin
|
5
|
-
RUBY_VERSION =~ /(\d+.\d+)/
|
6
|
-
require "#{$1}/libxml_ruby"
|
7
|
-
rescue LoadError
|
8
|
-
require "libxml_ruby"
|
9
|
-
end
|
10
|
-
|
11
|
-
# Load Ruby supporting code.
|
12
|
-
require 'libxml/error'
|
13
|
-
require 'libxml/parser'
|
14
|
-
require 'libxml/document'
|
15
|
-
require 'libxml/namespaces'
|
16
|
-
require 'libxml/namespace'
|
17
|
-
require 'libxml/node'
|
18
|
-
require 'libxml/attributes'
|
19
|
-
require 'libxml/attr'
|
20
|
-
require 'libxml/attr_decl'
|
21
|
-
require 'libxml/tree'
|
22
|
-
require 'libxml/html_parser'
|
23
|
-
require 'libxml/sax_parser'
|
24
|
-
require 'libxml/sax_callbacks'
|
25
|
-
|
26
|
-
#Schema Interface
|
27
|
-
require 'libxml/schema'
|
28
|
-
require 'libxml/schema/type'
|
29
|
-
require 'libxml/schema/element'
|
30
|
-
require 'libxml/schema/attribute'
|
5
|
+
require 'libxml-ruby'
|
data/libxml-ruby.gemspec
CHANGED
@@ -38,10 +38,10 @@ Gem::Specification.new do |spec|
|
|
38
38
|
'lib/**/*.rb',
|
39
39
|
'script/**/*',
|
40
40
|
'test/**/*'])
|
41
|
+
|
41
42
|
spec.test_files = Dir.glob('test/test_*.rb')
|
42
|
-
spec.required_ruby_version = '>=
|
43
|
+
spec.required_ruby_version = '>= 2.5'
|
43
44
|
spec.date = DateTime.now
|
44
|
-
#spec.add_development_dependency('hanna-nouveau')
|
45
45
|
spec.add_development_dependency('rake-compiler')
|
46
46
|
spec.add_development_dependency('minitest')
|
47
47
|
spec.license = 'MIT'
|
data/test/test_attr.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
|
3
|
+
require_relative './test_helper'
|
4
4
|
|
5
5
|
class AttrNodeTest < Minitest::Test
|
6
6
|
def setup
|
7
|
-
xp = XML::Parser.string(<<-EOS)
|
7
|
+
xp = LibXML::XML::Parser.string(<<-EOS)
|
8
8
|
<CityModel
|
9
9
|
xmlns="http://www.opengis.net/examples"
|
10
10
|
xmlns:city="http://www.opengis.net/examples"
|
@@ -34,19 +34,19 @@ class AttrNodeTest < Minitest::Test
|
|
34
34
|
|
35
35
|
def test_doc
|
36
36
|
refute_nil(@doc)
|
37
|
-
assert_equal(XML::Encoding::NONE, @doc.encoding)
|
37
|
+
assert_equal(LibXML::XML::Encoding::NONE, @doc.encoding)
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_types
|
41
41
|
attribute = city_member.attributes.get_attribute('name')
|
42
|
-
assert_instance_of(XML::Attr, attribute)
|
42
|
+
assert_instance_of(LibXML::XML::Attr, attribute)
|
43
43
|
assert_equal('attribute', attribute.node_type_name)
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_name
|
47
47
|
attribute = city_member.attributes.get_attribute('name')
|
48
48
|
assert_equal('name', attribute.name)
|
49
|
-
assert_equal(Encoding::UTF_8, attribute.name.encoding)
|
49
|
+
assert_equal(Encoding::UTF_8, attribute.name.encoding)
|
50
50
|
|
51
51
|
attribute = city_member.attributes.get_attribute('href')
|
52
52
|
assert_equal('href', attribute.name)
|
@@ -62,7 +62,7 @@ class AttrNodeTest < Minitest::Test
|
|
62
62
|
def test_value
|
63
63
|
attribute = city_member.attributes.get_attribute('name')
|
64
64
|
assert_equal('Cambridge', attribute.value)
|
65
|
-
assert_equal(Encoding::UTF_8, attribute.value.encoding)
|
65
|
+
assert_equal(Encoding::UTF_8, attribute.value.encoding)
|
66
66
|
|
67
67
|
attribute = city_member.attributes.get_attribute('href')
|
68
68
|
assert_equal('http://www.foo.net/cgi-bin/wfs?FeatureID=C10239', attribute.value)
|
@@ -72,12 +72,12 @@ class AttrNodeTest < Minitest::Test
|
|
72
72
|
attribute = city_member.attributes.get_attribute('name')
|
73
73
|
attribute.value = 'London'
|
74
74
|
assert_equal('London', attribute.value)
|
75
|
-
assert_equal(Encoding::UTF_8, attribute.value.encoding)
|
75
|
+
assert_equal(Encoding::UTF_8, attribute.value.encoding)
|
76
76
|
|
77
77
|
attribute = city_member.attributes.get_attribute('href')
|
78
78
|
attribute.value = 'http://i.have.changed'
|
79
79
|
assert_equal('http://i.have.changed', attribute.value)
|
80
|
-
assert_equal(Encoding::UTF_8, attribute.value.encoding)
|
80
|
+
assert_equal(Encoding::UTF_8, attribute.value.encoding)
|
81
81
|
end
|
82
82
|
|
83
83
|
def test_set_nil
|
@@ -91,8 +91,8 @@ class AttrNodeTest < Minitest::Test
|
|
91
91
|
attributes = city_member.attributes
|
92
92
|
assert_equal(5, attributes.length)
|
93
93
|
|
94
|
-
attr = XML::Attr.new(city_member, 'size', '50,000')
|
95
|
-
assert_instance_of(XML::Attr, attr)
|
94
|
+
attr = LibXML::XML::Attr.new(city_member, 'size', '50,000')
|
95
|
+
assert_instance_of(LibXML::XML::Attr, attr)
|
96
96
|
|
97
97
|
attributes = city_member.attributes
|
98
98
|
assert_equal(6, attributes.length)
|
@@ -115,9 +115,9 @@ class AttrNodeTest < Minitest::Test
|
|
115
115
|
def test_create_ns
|
116
116
|
assert_equal(5, city_member.attributes.length)
|
117
117
|
|
118
|
-
ns = XML::Namespace.new(city_member, 'my_namepace', 'http://www.mynamespace.com')
|
119
|
-
attr = XML::Attr.new(city_member, 'rating', 'rocks', ns)
|
120
|
-
assert_instance_of(XML::Attr, attr)
|
118
|
+
ns = LibXML::XML::Namespace.new(city_member, 'my_namepace', 'http://www.mynamespace.com')
|
119
|
+
attr = LibXML::XML::Attr.new(city_member, 'rating', 'rocks', ns)
|
120
|
+
assert_instance_of(LibXML::XML::Attr, attr)
|
121
121
|
assert_equal('rating', attr.name)
|
122
122
|
assert_equal('rocks', attr.value)
|
123
123
|
|
@@ -144,27 +144,27 @@ class AttrNodeTest < Minitest::Test
|
|
144
144
|
|
145
145
|
def test_first
|
146
146
|
attribute = city_member.attributes.first
|
147
|
-
assert_instance_of(XML::Attr, attribute)
|
147
|
+
assert_instance_of(LibXML::XML::Attr, attribute)
|
148
148
|
assert_equal('name', attribute.name)
|
149
149
|
assert_equal('Cambridge', attribute.value)
|
150
150
|
|
151
151
|
attribute = attribute.next
|
152
|
-
assert_instance_of(XML::Attr, attribute)
|
152
|
+
assert_instance_of(LibXML::XML::Attr, attribute)
|
153
153
|
assert_equal('type', attribute.name)
|
154
154
|
assert_equal('simple', attribute.value)
|
155
155
|
|
156
156
|
attribute = attribute.next
|
157
|
-
assert_instance_of(XML::Attr, attribute)
|
157
|
+
assert_instance_of(LibXML::XML::Attr, attribute)
|
158
158
|
assert_equal('title', attribute.name)
|
159
159
|
assert_equal('Trinity Lane', attribute.value)
|
160
160
|
|
161
161
|
attribute = attribute.next
|
162
|
-
assert_instance_of(XML::Attr, attribute)
|
162
|
+
assert_instance_of(LibXML::XML::Attr, attribute)
|
163
163
|
assert_equal('href', attribute.name)
|
164
164
|
assert_equal('http://www.foo.net/cgi-bin/wfs?FeatureID=C10239', attribute.value)
|
165
165
|
|
166
166
|
attribute = attribute.next
|
167
|
-
assert_instance_of(XML::Attr, attribute)
|
167
|
+
assert_instance_of(LibXML::XML::Attr, attribute)
|
168
168
|
assert_equal('remoteSchema', attribute.name)
|
169
169
|
assert_equal("city.xsd#xpointer(//complexType[@name='RoadType'])", attribute.value)
|
170
170
|
|
data/test/test_attr_decl.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
|
3
|
+
require_relative './test_helper'
|
4
4
|
|
5
5
|
class AttrDeclTest < Minitest::Test
|
6
6
|
def setup
|
7
|
-
xp = XML::Parser.string(<<-EOS)
|
7
|
+
xp = LibXML::XML::Parser.string(<<-EOS)
|
8
8
|
<!DOCTYPE test [
|
9
9
|
<!ELEMENT root (property*)>
|
10
10
|
<!ELEMENT property EMPTY>
|
@@ -42,7 +42,7 @@ class AttrDeclTest < Minitest::Test
|
|
42
42
|
# Get the attr_decl
|
43
43
|
attr = elem.attributes.get_attribute('access')
|
44
44
|
refute_nil(attr)
|
45
|
-
assert_equal(XML::Node::ATTRIBUTE_NODE, attr.node_type)
|
45
|
+
assert_equal(LibXML::XML::Node::ATTRIBUTE_NODE, attr.node_type)
|
46
46
|
assert_equal('attribute', attr.node_type_name)
|
47
47
|
|
48
48
|
# Get its value
|
@@ -56,7 +56,7 @@ class AttrDeclTest < Minitest::Test
|
|
56
56
|
# Get the attr_decl
|
57
57
|
attr_decl = elem.attributes.get_attribute('access')
|
58
58
|
refute_nil(attr_decl)
|
59
|
-
assert_equal(XML::Node::ATTRIBUTE_DECL, attr_decl.node_type)
|
59
|
+
assert_equal(LibXML::XML::Node::ATTRIBUTE_DECL, attr_decl.node_type)
|
60
60
|
assert_equal('attribute declaration', attr_decl.node_type_name)
|
61
61
|
|
62
62
|
# Get its value
|
@@ -69,7 +69,7 @@ class AttrDeclTest < Minitest::Test
|
|
69
69
|
attr_decl = elem.attributes.get_attribute('access')
|
70
70
|
|
71
71
|
refute_nil(attr_decl)
|
72
|
-
assert_equal(XML::Node::ATTRIBUTE_DECL, attr_decl.node_type)
|
72
|
+
assert_equal(LibXML::XML::Node::ATTRIBUTE_DECL, attr_decl.node_type)
|
73
73
|
assert_equal('attribute declaration', attr_decl.node_type_name)
|
74
74
|
end
|
75
75
|
|
@@ -99,12 +99,12 @@ class AttrDeclTest < Minitest::Test
|
|
99
99
|
attr_decl = elem.attributes.get_attribute('access')
|
100
100
|
|
101
101
|
first_decl = attr_decl.prev
|
102
|
-
assert_equal(XML::Node::ATTRIBUTE_DECL, first_decl.node_type)
|
102
|
+
assert_equal(LibXML::XML::Node::ATTRIBUTE_DECL, first_decl.node_type)
|
103
103
|
assert_equal('name', first_decl.name)
|
104
104
|
assert_nil(first_decl.value)
|
105
105
|
|
106
106
|
elem_decl = first_decl.prev
|
107
|
-
assert_equal(XML::Node::ELEMENT_DECL, elem_decl.node_type)
|
107
|
+
assert_equal(LibXML::XML::Node::ELEMENT_DECL, elem_decl.node_type)
|
108
108
|
end
|
109
109
|
|
110
110
|
def test_next
|
@@ -127,6 +127,6 @@ class AttrDeclTest < Minitest::Test
|
|
127
127
|
attr_decl = elem.attributes.get_attribute('access')
|
128
128
|
|
129
129
|
parent = attr_decl.parent
|
130
|
-
assert_instance_of(XML::Dtd, parent)
|
130
|
+
assert_instance_of(LibXML::XML::Dtd, parent)
|
131
131
|
end
|
132
132
|
end
|