libxml-ruby 5.0.0-x64-mingw-ucrt → 5.0.2-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY +10 -3
- data/README.rdoc +7 -16
- data/ext/libxml/ruby_xml_dtd.c +95 -86
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/lib/3.2/libxml_ruby.so +0 -0
- data/lib/3.3/libxml_ruby.so +0 -0
- data/lib/libxml/document.rb +2 -2
- data/test/test_document.rb +9 -1
- data/test/test_dtd.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79d7bc579d2e290cce414e539ee240f35b70c3a35fb9eaec8035aad4e7ed5c7f
|
4
|
+
data.tar.gz: c0ca3c3b26cc9f0dc0eddbf5b45808305f2676f9b1b440e09da74a65c77e9702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 715379b82daad34826ee49bf5122c01fa46bd44a6f8e82e10f37eabedc99747ff44cc487c3851e698f164c258cf7c884efd291f727a447ab7103ba2b0cd4ed3b
|
7
|
+
data.tar.gz: 1a73a86c1245951d5fcd5fe156c6e3cae1e97023ca814ad3ffcb47c3ed3dcb3735d899bd090eacdb44e3cbe4e3f94cd41002089186f8d7dabf8c9e3741be3513
|
data/HISTORY
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 5.0.2 / 2024-01-08
|
4
|
+
|
5
|
+
* Fix broken DTD creation (DTD name is not required)
|
6
|
+
|
7
|
+
== 5.0.1 / 2024-01-08
|
8
|
+
|
9
|
+
* Fix broken Document#io method that was broken by switching Parsers to use keyword arguments
|
10
|
+
|
3
11
|
== 5.0.0 / 2024-01-07
|
4
12
|
|
5
13
|
* This release is major version bump because it removes access to global parser options
|
@@ -8,9 +16,8 @@
|
|
8
16
|
Specifically, instead of setting global parser options, pass them directly to either Parsers
|
9
17
|
or ParserContexts when creating them. Options are defined as constants in
|
10
18
|
LibXML::XML::Parser::Options and LibXML::HTML::Parser::Options
|
11
|
-
* Update Parser initialize methods to take
|
12
|
-
|
13
|
-
* Fix broken compiliation with libxml2 version 2.12.0 (due to libxml2 header changes)
|
19
|
+
* Update Parser initialize methods to take keyword parameters instead of a hash table (you may have to update your code due to this change)
|
20
|
+
* Fix broken compilation with libxml2 version 2.12.0 (due to libxml2 header changes)
|
14
21
|
* Add support for Ruby 3.3.*
|
15
22
|
* Remove support for Ruby 2.7.* (gem should still work but is no longer tested)
|
16
23
|
|
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@ We think libxml-ruby is the best XML library for Ruby because:
|
|
11
11
|
* Conformance - It passes all 1800+ tests from the OASIS XML Tests Suite
|
12
12
|
|
13
13
|
== Requirements
|
14
|
-
libxml-ruby requires Ruby
|
14
|
+
libxml-ruby requires Ruby 3.0.0 or higher. It depends on libxml2 to
|
15
15
|
function properly. libxml2, in turn, depends on:
|
16
16
|
|
17
17
|
* libm (math routines: very standard)
|
@@ -20,9 +20,9 @@ function properly. libxml2, in turn, depends on:
|
|
20
20
|
|
21
21
|
If you are running Linux or Unix you'll need a C compiler so the
|
22
22
|
extension can be compiled when it is installed. If you are running
|
23
|
-
Windows, then install the x64-
|
24
|
-
|
25
|
-
|
23
|
+
Windows, then install the x64-mingw-ucr gem or build it yourself using (Ruby
|
24
|
+
for Windows)[https://rubyinstaller.org/] or directly with msys2[https://msys2.github.io/]
|
25
|
+
and ucrt64.
|
26
26
|
|
27
27
|
== Installation
|
28
28
|
The easiest way to install libxml-ruby is via RubyGems. To install:
|
@@ -46,13 +46,9 @@ Or bundler:
|
|
46
46
|
<tt>bundle install libxml-ruby</tt>
|
47
47
|
|
48
48
|
If you are running Windows, then install the libxml-ruby-x64-mingw32 gem.
|
49
|
-
The gem includes prebuilt extensions for Ruby 2.3.
|
50
|
-
extensions are built using MinGW64 and libxml2 version 2.9.3,
|
51
|
-
iconv version 1.14 and zlib version 1.2.8. Note these binaries
|
52
|
-
are available in the <tt>lib\\libs</tt> directory. To use them, put them
|
53
|
-
on your <tt>PATH</tt>.
|
49
|
+
The gem includes prebuilt extensions for Ruby 3.2 and 3.3.
|
54
50
|
|
55
|
-
The gem also includes a Microsoft VC++
|
51
|
+
The gem also includes a Microsoft VC++ solution and XCode project - these
|
56
52
|
are very useful for debugging.
|
57
53
|
|
58
54
|
libxml-ruby's source codes lives on GitHub[https://github.com/xml4r/libxml-ruby].
|
@@ -128,11 +124,6 @@ For example:
|
|
128
124
|
|
129
125
|
For simplicity's sake, the documentation uses the xml module in its examples.
|
130
126
|
|
131
|
-
== Threading
|
132
|
-
libxml-ruby fully supports native, background Ruby threads. This of course
|
133
|
-
only applies to Ruby 1.9.x and higher since earlier versions of Ruby do not
|
134
|
-
support native threads.
|
135
|
-
|
136
127
|
== Tests
|
137
128
|
|
138
129
|
To run tests you first need to build the shared libary:
|
@@ -143,7 +134,7 @@ Once you have build the shared libary, you can then run tests using rake:
|
|
143
134
|
|
144
135
|
rake test
|
145
136
|
|
146
|
-
+
|
137
|
+
+Build status: {rdoc-image:https://github.com/xml4r/libxml-ruby/actions/workflows/mri.yml/badge.svg}[https://github.com/xml4r/libxml-ruby/actions/workflows/mri.yml]
|
147
138
|
|
148
139
|
== Performance
|
149
140
|
|
data/ext/libxml/ruby_xml_dtd.c
CHANGED
@@ -124,112 +124,121 @@ static VALUE rxml_dtd_type(VALUE self)
|
|
124
124
|
|
125
125
|
/*
|
126
126
|
* call-seq:
|
127
|
-
* XML::Dtd.new(
|
128
|
-
* XML::Dtd.new(
|
129
|
-
* XML::Dtd.new(
|
130
|
-
* XML::Dtd.new("name", "public", "system", document, false) -> internal subset dtd
|
131
|
-
* XML::Dtd.new("name", "public", "system", document, true) -> internal subset dtd
|
127
|
+
* XML::Dtd.new(dtd_string) -> dtd
|
128
|
+
* XML::Dtd.new(external_id, system_id) -> dtd
|
129
|
+
* XML::Dtd.new(external_id, system_id, name, document, internal) -> dtd
|
132
130
|
*
|
133
|
-
* Create a new Dtd from the specified public and system
|
134
|
-
*
|
131
|
+
* Create a new Dtd from the specified public and system identifiers:
|
132
|
+
*
|
133
|
+
* * The first usage creates a DTD from a string and requires 1 parameter.
|
134
|
+
* * The second usage loads and parses an external DTD and requires 2 parameters.
|
135
|
+
* * The third usage creates a new internal or external DTD and requires 2 parameters and 3 optional parameters.
|
136
|
+
* The DTD is then attached to the specified document if it is not nil.
|
137
|
+
*
|
138
|
+
* Parameters:
|
139
|
+
*
|
140
|
+
* dtd_string - A string that contains a complete DTD
|
141
|
+
* external_id - A string that specifies the DTD's external name. For example, "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
142
|
+
* system_id - A string that specififies the DTD's system name. For example, "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
|
143
|
+
* name - A string that specifies the DTD's name. For example "xhtml1".
|
144
|
+
* document - A xml document.
|
145
|
+
* internal - Boolean value indicating whether this is an internal or external DTD. Optional. If not specified
|
146
|
+
* then external is assumed.
|
135
147
|
*/
|
136
148
|
static VALUE rxml_dtd_initialize(int argc, VALUE *argv, VALUE self)
|
137
149
|
{
|
138
|
-
VALUE external, system, dtd_string;
|
139
|
-
xmlParserInputBufferPtr buffer;
|
140
|
-
xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
|
141
|
-
xmlChar *new_string;
|
142
150
|
xmlDtdPtr xdtd;
|
151
|
+
VALUE external, system;
|
143
152
|
|
144
|
-
// 1 argument -- string --> parsujeme jako dtd
|
145
|
-
// 2 arguments -- public, system --> bude se hledat
|
146
|
-
// 3 arguments -- public, system, name --> creates an external subset (any parameter may be nil)
|
147
|
-
// 4 arguments -- public, system, name, doc --> creates an external subset (any parameter may be nil)
|
148
|
-
// 5 arguments -- public, system, name, doc, true --> creates an internal subset (all but last parameter may be nil)
|
149
153
|
switch (argc)
|
150
154
|
{
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
155
|
+
case 3:
|
156
|
+
case 4:
|
157
|
+
case 5:
|
158
|
+
{
|
159
|
+
const xmlChar *xname = NULL, *xpublic = NULL, *xsystem = NULL;
|
160
|
+
xmlDocPtr xdoc = NULL;
|
161
|
+
|
162
|
+
VALUE name, doc, internal;
|
163
|
+
rb_scan_args(argc, argv, "23", &external, &system, &name, &doc, &internal);
|
164
|
+
|
165
|
+
Check_Type(external, T_STRING);
|
166
|
+
xpublic = (const xmlChar*) StringValuePtr(external);
|
167
|
+
|
168
|
+
Check_Type(system, T_STRING);
|
169
|
+
xsystem = (const xmlChar*) StringValuePtr(system);
|
170
|
+
|
171
|
+
if (name != Qnil)
|
172
|
+
{
|
173
|
+
Check_Type(name, T_STRING);
|
174
|
+
xname = (const xmlChar*)StringValuePtr(name);
|
175
|
+
}
|
176
|
+
|
177
|
+
if (doc != Qnil)
|
178
|
+
{
|
179
|
+
if (rb_obj_is_kind_of(doc, cXMLDocument) == Qfalse)
|
180
|
+
rb_raise(rb_eTypeError, "Must pass an LibXML::XML::Document object");
|
181
|
+
Data_Get_Struct(doc, xmlDoc, xdoc);
|
182
|
+
}
|
183
|
+
|
184
|
+
if (internal == Qnil || internal == Qfalse)
|
185
|
+
xdtd = xmlNewDtd(xdoc, xname, xpublic, xsystem);
|
186
|
+
else
|
187
|
+
xdtd = xmlCreateIntSubset(xdoc, xname, xpublic, xsystem);
|
188
|
+
|
189
|
+
if (xdtd == NULL)
|
190
|
+
rxml_raise(xmlGetLastError());
|
191
|
+
|
192
|
+
/* The document will free the dtd so Ruby should not */
|
193
|
+
RDATA(self)->dfree = NULL;
|
194
|
+
DATA_PTR(self) = xdtd;
|
195
|
+
|
196
|
+
xmlSetTreeDoc((xmlNodePtr) xdtd, xdoc);
|
197
|
+
}
|
198
|
+
break;
|
199
|
+
|
200
|
+
case 2:
|
201
|
+
{
|
202
|
+
rb_scan_args(argc, argv, "20", &external, &system);
|
157
203
|
|
158
|
-
rb_scan_args(argc, argv, "32", &external, &system, &name, &doc, &internal);
|
159
|
-
|
160
|
-
if (external != Qnil) {
|
161
204
|
Check_Type(external, T_STRING);
|
162
|
-
xpublic = (const xmlChar*) StringValuePtr(external);
|
163
|
-
}
|
164
|
-
if (system != Qnil) {
|
165
205
|
Check_Type(system, T_STRING);
|
166
|
-
xsystem = (const xmlChar*) StringValuePtr(system);
|
167
|
-
}
|
168
|
-
if (name != Qnil) {
|
169
|
-
Check_Type(name, T_STRING);
|
170
|
-
xname = (const xmlChar*) StringValuePtr(name);
|
171
|
-
}
|
172
|
-
if (doc != Qnil) {
|
173
|
-
if (rb_obj_is_kind_of(doc, cXMLDocument) == Qfalse)
|
174
|
-
rb_raise(rb_eTypeError, "Must pass an LibXML::XML::Document object");
|
175
|
-
Data_Get_Struct(doc, xmlDoc, xdoc);
|
176
|
-
}
|
177
|
-
|
178
|
-
if (internal == Qnil || internal == Qfalse)
|
179
|
-
xdtd = xmlNewDtd(xdoc, xname, xpublic, xsystem);
|
180
|
-
else
|
181
|
-
xdtd = xmlCreateIntSubset(xdoc, xname, xpublic, xsystem);
|
182
|
-
|
183
|
-
if (xdtd == NULL)
|
184
|
-
rxml_raise(xmlGetLastError());
|
185
|
-
|
186
|
-
/* Document will free this dtd now. */
|
187
|
-
RDATA(self)->dfree = NULL;
|
188
|
-
DATA_PTR(self) = xdtd;
|
189
206
|
|
190
|
-
|
191
|
-
}
|
192
|
-
break;
|
207
|
+
xdtd = xmlParseDTD((xmlChar*) StringValuePtr(external), (xmlChar*) StringValuePtr(system));
|
193
208
|
|
194
|
-
|
195
|
-
|
209
|
+
if (xdtd == NULL)
|
210
|
+
rxml_raise(xmlGetLastError());
|
196
211
|
|
197
|
-
|
198
|
-
Check_Type(system, T_STRING);
|
212
|
+
DATA_PTR(self) = xdtd;
|
199
213
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
xmlSetTreeDoc((xmlNodePtr) xdtd, NULL);
|
209
|
-
break;
|
210
|
-
|
211
|
-
case 1:
|
212
|
-
rb_scan_args(argc, argv, "10", &dtd_string);
|
213
|
-
Check_Type(dtd_string, T_STRING);
|
214
|
-
|
215
|
-
/* Note that buffer is freed by xmlParserInputBufferPush*/
|
216
|
-
buffer = xmlAllocParserInputBuffer(enc);
|
217
|
-
new_string = xmlStrdup((xmlChar*) StringValuePtr(dtd_string));
|
218
|
-
xmlParserInputBufferPush(buffer, xmlStrlen(new_string),
|
219
|
-
(const char*) new_string);
|
214
|
+
xmlSetTreeDoc((xmlNodePtr) xdtd, NULL);
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
case 1:
|
218
|
+
{
|
219
|
+
VALUE dtd_string;
|
220
|
+
rb_scan_args(argc, argv, "10", &dtd_string);
|
221
|
+
Check_Type(dtd_string, T_STRING);
|
220
222
|
|
221
|
-
|
223
|
+
/* Note that buffer is freed by xmlParserInputBufferPush*/
|
224
|
+
xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
|
225
|
+
xmlParserInputBufferPtr buffer = xmlAllocParserInputBuffer(enc);
|
226
|
+
xmlChar *new_string = xmlStrdup((xmlChar*) StringValuePtr(dtd_string));
|
227
|
+
xmlParserInputBufferPush(buffer, xmlStrlen(new_string),
|
228
|
+
(const char*) new_string);
|
222
229
|
|
223
|
-
|
224
|
-
rxml_raise(xmlGetLastError());
|
230
|
+
xdtd = xmlIOParseDTD(NULL, buffer, enc);
|
225
231
|
|
226
|
-
|
232
|
+
if (xdtd == NULL)
|
233
|
+
rxml_raise(xmlGetLastError());
|
227
234
|
|
228
|
-
|
229
|
-
break;
|
235
|
+
xmlFree(new_string);
|
230
236
|
|
231
|
-
|
232
|
-
|
237
|
+
DATA_PTR(self) = xdtd;
|
238
|
+
break;
|
239
|
+
}
|
240
|
+
default:
|
241
|
+
rb_raise(rb_eArgError, "wrong number of arguments");
|
233
242
|
}
|
234
243
|
|
235
244
|
return self;
|
@@ -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 "5.0.
|
5
|
-
#define RUBY_LIBXML_VERNUM
|
4
|
+
#define RUBY_LIBXML_VERSION "5.0.2"
|
5
|
+
#define RUBY_LIBXML_VERNUM 502
|
6
6
|
#define RUBY_LIBXML_VER_MAJ 5
|
7
7
|
#define RUBY_LIBXML_VER_MIN 0
|
8
|
-
#define RUBY_LIBXML_VER_MIC
|
8
|
+
#define RUBY_LIBXML_VER_MIC 2
|
9
9
|
#define RUBY_LIBXML_VER_PATCH 0
|
data/lib/3.2/libxml_ruby.so
CHANGED
Binary file
|
data/lib/3.3/libxml_ruby.so
CHANGED
Binary file
|
data/lib/libxml/document.rb
CHANGED
@@ -51,8 +51,8 @@ module LibXML
|
|
51
51
|
# options - Parser options. Valid values are the constants defined on
|
52
52
|
# XML::Parser::Options. Mutliple options can be combined
|
53
53
|
# by using Bitwise OR (|).
|
54
|
-
def self.io(
|
55
|
-
Parser.io(
|
54
|
+
def self.io(io, base_uri: nil, encoding: nil, options: nil)
|
55
|
+
Parser.io(io, base_uri: base_uri, encoding: encoding, options: options).parse
|
56
56
|
end
|
57
57
|
|
58
58
|
# call-seq:
|
data/test/test_document.rb
CHANGED
@@ -82,7 +82,7 @@ class TestDocument < Minitest::Test
|
|
82
82
|
def test_xhtml
|
83
83
|
doc = LibXML::XML::Document.new
|
84
84
|
assert(!doc.xhtml?)
|
85
|
-
LibXML::XML::Dtd.new
|
85
|
+
LibXML::XML::Dtd.new("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", nil, doc, true)
|
86
86
|
assert(doc.xhtml?)
|
87
87
|
end
|
88
88
|
|
@@ -129,4 +129,12 @@ class TestDocument < Minitest::Test
|
|
129
129
|
file = File.join(File.dirname(__FILE__), 'model/atom.xml')
|
130
130
|
schema_document = LibXML::XML::Document.file(file, options: LibXML::XML::Parser::Options::NONET)
|
131
131
|
end
|
132
|
+
|
133
|
+
def test_io
|
134
|
+
File.open(File.join(File.dirname(__FILE__), 'model/rubynet.xml')) do |io|
|
135
|
+
doc = LibXML::XML::Document.io(io)
|
136
|
+
assert_instance_of(LibXML::XML::Document, doc)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
132
140
|
end
|
data/test/test_dtd.rb
CHANGED
@@ -31,13 +31,13 @@ class TestDtd < Minitest::Test
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_internal_subset
|
34
|
-
xhtml_dtd = LibXML::XML::Dtd.new
|
34
|
+
xhtml_dtd = LibXML::XML::Dtd.new("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", nil, nil, true)
|
35
35
|
assert xhtml_dtd.name.nil?
|
36
36
|
assert_equal "-//W3C//DTD XHTML 1.0 Transitional//EN", xhtml_dtd.external_id
|
37
37
|
assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.uri
|
38
38
|
assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.system_id
|
39
39
|
|
40
|
-
xhtml_dtd = LibXML::XML::Dtd.new
|
40
|
+
xhtml_dtd = LibXML::XML::Dtd.new("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", "xhtml1", nil, true)
|
41
41
|
assert_equal "xhtml1", xhtml_dtd.name
|
42
42
|
assert_equal "-//W3C//DTD XHTML 1.0 Transitional//EN", xhtml_dtd.external_id
|
43
43
|
assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.uri
|
@@ -45,13 +45,13 @@ class TestDtd < Minitest::Test
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_external_subset
|
48
|
-
xhtml_dtd = LibXML::XML::Dtd.new
|
48
|
+
xhtml_dtd = LibXML::XML::Dtd.new("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", nil)
|
49
49
|
assert xhtml_dtd.name.nil?
|
50
50
|
assert_equal "-//W3C//DTD XHTML 1.0 Transitional//EN", xhtml_dtd.external_id
|
51
51
|
assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.uri
|
52
52
|
assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.system_id
|
53
53
|
|
54
|
-
xhtml_dtd = LibXML::XML::Dtd.new
|
54
|
+
xhtml_dtd = LibXML::XML::Dtd.new("-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", "xhtml1")
|
55
55
|
assert_equal "xhtml1", xhtml_dtd.name
|
56
56
|
assert_equal "-//W3C//DTD XHTML 1.0 Transitional//EN", xhtml_dtd.external_id
|
57
57
|
assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.uri
|
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: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: x64-mingw-ucrt
|
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: 2024-01-
|
17
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rake-compiler
|