libxml-ruby 3.0.0-x64-mingw32 → 3.2.2-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/HISTORY +37 -0
- data/MANIFEST +34 -34
- data/README.rdoc +65 -36
- data/Rakefile +21 -3
- 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 -5
- data/ext/libxml/ruby_xml_dtd.c +6 -8
- data/ext/libxml/ruby_xml_encoding.c +1 -13
- data/ext/libxml/ruby_xml_encoding.h +0 -3
- data/ext/libxml/ruby_xml_error.c +1 -1
- data/ext/libxml/ruby_xml_error.h +1 -1
- data/ext/libxml/ruby_xml_io.c +14 -18
- data/ext/libxml/ruby_xml_io.h +1 -1
- data/ext/libxml/ruby_xml_node.c +16 -17
- data/ext/libxml/ruby_xml_parser_context.c +1 -1
- data/ext/libxml/ruby_xml_reader.c +7 -2
- data/ext/libxml/ruby_xml_schema.c +44 -66
- data/ext/libxml/ruby_xml_schema_element.c +15 -14
- data/ext/libxml/ruby_xml_schema_type.c +66 -93
- data/ext/libxml/ruby_xml_version.h +4 -4
- data/ext/libxml/ruby_xml_writer.c +189 -192
- data/lib/3.0/libxml_ruby.so +0 -0
- data/lib/libxml/schema/element.rb +0 -8
- data/lib/libxml/schema/type.rb +0 -8
- data/lib/libxml/schema.rb +0 -19
- data/lib/libxml-ruby.rb +30 -0
- data/lib/libxml.rb +3 -28
- data/libxml-ruby.gemspec +5 -4
- data/setup.rb +0 -1
- data/test/model/cwm_1_0.xml +11336 -0
- data/test/{tc_attr.rb → test_attr.rb} +18 -18
- data/test/{tc_attr_decl.rb → test_attr_decl.rb} +8 -8
- data/test/{tc_attributes.rb → test_attributes.rb} +10 -10
- data/test/{tc_canonicalize.rb → test_canonicalize.rb} +35 -39
- data/test/test_deprecated_require.rb +12 -0
- data/test/{tc_document.rb → test_document.rb} +31 -24
- data/test/test_document_write.rb +146 -0
- data/test/{tc_dtd.rb → test_dtd.rb} +26 -25
- data/test/{tc_encoding.rb → test_encoding.rb} +20 -17
- data/test/{tc_encoding_sax.rb → test_encoding_sax.rb} +3 -3
- data/test/test_error.rb +178 -0
- data/test/test_helper.rb +4 -11
- data/test/{tc_html_parser.rb → test_html_parser.rb} +31 -30
- data/test/test_html_parser_context.rb +23 -0
- data/test/test_namespace.rb +60 -0
- data/test/{tc_namespaces.rb → test_namespaces.rb} +29 -38
- data/test/{tc_node.rb → test_node.rb} +37 -31
- data/test/{tc_node_cdata.rb → test_node_cdata.rb} +10 -10
- data/test/{tc_node_comment.rb → test_node_comment.rb} +6 -6
- data/test/{tc_node_copy.rb → test_node_copy.rb} +3 -4
- data/test/{tc_node_edit.rb → test_node_edit.rb} +20 -21
- data/test/{tc_node_pi.rb → test_node_pi.rb} +8 -10
- data/test/{tc_node_text.rb → test_node_text.rb} +8 -9
- data/test/{tc_node_write.rb → test_node_write.rb} +16 -26
- data/test/test_node_xlink.rb +28 -0
- data/test/{tc_parser.rb → test_parser.rb} +72 -75
- data/test/{tc_parser_context.rb → test_parser_context.rb} +38 -44
- data/test/{tc_properties.rb → test_properties.rb} +5 -5
- data/test/test_reader.rb +364 -0
- data/test/{tc_relaxng.rb → test_relaxng.rb} +11 -11
- data/test/{tc_sax_parser.rb → test_sax_parser.rb} +38 -31
- data/test/{tc_schema.rb → test_schema.rb} +40 -33
- data/test/test_suite.rb +39 -40
- data/test/{tc_traversal.rb → test_traversal.rb} +4 -4
- data/test/{tc_writer.rb → test_writer.rb} +95 -74
- data/test/{tc_xinclude.rb → test_xinclude.rb} +3 -3
- data/test/test_xml.rb +263 -0
- data/test/{tc_xpath.rb → test_xpath.rb} +25 -25
- data/test/{tc_xpath_context.rb → test_xpath_context.rb} +5 -5
- data/test/{tc_xpath_expression.rb → test_xpath_expression.rb} +7 -7
- data/test/{tc_xpointer.rb → test_xpointer.rb} +15 -15
- metadata +92 -106
- data/lib/2.4/libxml_ruby.so +0 -0
- data/lib/libs/libiconv-2.dll +0 -0
- data/lib/libs/libxml2-2.dll +0 -0
- data/lib/libs/zlib1.dll +0 -0
- data/test/tc_deprecated_require.rb +0 -12
- data/test/tc_document_write.rb +0 -195
- data/test/tc_error.rb +0 -178
- data/test/tc_html_parser_context.rb +0 -23
- data/test/tc_namespace.rb +0 -61
- data/test/tc_node_xlink.rb +0 -28
- data/test/tc_reader.rb +0 -358
- data/test/tc_xml.rb +0 -225
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 96fdb761fe5ba6333b9d6cedf5cfb395d6a177bc02ad5aed1bf2f269d027cd04
|
4
|
+
data.tar.gz: c4761509dee6f67a3736718349f33c516d2c617429d559a732c73c855a725506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b0cdc74c5c3ebe00a65c811e15eb60d47937b2a6050a004d5c08e6d3e275918da7929ce874b7353daed587432b7e83c8d754a240a5e295c4c7abdb2086523d3
|
7
|
+
data.tar.gz: 3851c2f2155f3dbe9674821208b128eb0480a51795e05ec6593aded6ec61628c98f765baa64f8d81313b2e6a24e2478aaf6dfc575c6903cab272da7e9073f6d9
|
data/HISTORY
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 3.2.2 / 2022-01-15
|
4
|
+
* Switch to Github actions for CI/CD (Greg)
|
5
|
+
* Test fixes (Greg, Sergio Durigan Junior)
|
6
|
+
* Fix typo on test/test_sax_parser.rb (Sergio Durigan Junior)
|
7
|
+
* Update homepage in gemspec (Pirate Praveen Arimbrathodiyil)
|
8
|
+
|
9
|
+
== 3.2.1 / 2020-11-05
|
10
|
+
|
11
|
+
* Fix incorrect handling of encodings when using XMLWriter.io (Charlie Savage)
|
12
|
+
* Clean up README (Richard Michael)
|
13
|
+
|
14
|
+
== 3.2.0 / 2020-05-09 Charlie Savage
|
15
|
+
|
16
|
+
* Fix crash when creating an empty DTD
|
17
|
+
* Modernize tests to use Bundler to load gem
|
18
|
+
* Add libxml-ruby.rb file so gem loads in expected way.
|
19
|
+
* Add support for xmlSaveNoEmptyTags.
|
20
|
+
* Clean up extconf.rb file
|
21
|
+
|
22
|
+
== 3.1.0 / 2018-02-03 Charlie Savage
|
23
|
+
|
24
|
+
* Fix segmentation fault when adding one node to another node (Charlie Savage)
|
25
|
+
* Fix deprecated "assert_equal(nil, expected)" calls. #148 and #151. (utilum)
|
26
|
+
* Remove assigned but unused variables. #150 (utilum)
|
27
|
+
* Add Gemfile. #146. (Dorian Marié)
|
28
|
+
* Remove duplicate hash key in setup.rb. #147. (Dorian Marié)
|
29
|
+
* Fix gemspec by requiring Date. #149 (utilum)
|
30
|
+
* Restore default internal encoding after tests are completed. #123 (Charlie Savage)
|
31
|
+
* Remove duplicate method definitions. #145. (Charlie Savage)
|
32
|
+
* Remove SchemaElement#minOccurs and SchemaElement#maxOccurs since they actually did not work (Charlie Savage)
|
33
|
+
* Rename test files to follow Ruby conventions (Charlie Savage)
|
34
|
+
* Fix handling of node returned by Reader#expand. #142. (Charlie Savage)
|
35
|
+
* Add Travis Build support (Charlie Savage)
|
36
|
+
* Fix Fixnum deprecation (Charlie Savage)
|
37
|
+
* Cleanup schema code (Charlie Savage)
|
38
|
+
* Update Visual Studio project to 2017 (Charlie Savage)
|
39
|
+
|
3
40
|
== 3.0.0 / 2017-02-07 Charlie Savage
|
4
41
|
|
5
42
|
* Revamp how libxml-ruby manages memory. Instead of trying to return the same ruby object for each xmlnode,
|
data/MANIFEST
CHANGED
@@ -122,40 +122,40 @@ test/model/shiporder.xml
|
|
122
122
|
test/model/shiporder.xsd
|
123
123
|
test/model/soap.xml
|
124
124
|
test/model/xinclude.xml
|
125
|
-
test/
|
126
|
-
test/
|
127
|
-
test/
|
128
|
-
test/
|
129
|
-
test/
|
130
|
-
test/
|
131
|
-
test/
|
132
|
-
test/
|
133
|
-
test/
|
134
|
-
test/
|
135
|
-
test/
|
136
|
-
test/
|
137
|
-
test/
|
138
|
-
test/
|
139
|
-
test/
|
140
|
-
test/
|
141
|
-
test/
|
142
|
-
test/
|
143
|
-
test/
|
144
|
-
test/
|
145
|
-
test/
|
146
|
-
test/
|
147
|
-
test/
|
148
|
-
test/
|
149
|
-
test/
|
150
|
-
test/
|
151
|
-
test/
|
152
|
-
test/
|
153
|
-
test/
|
154
|
-
test/
|
155
|
-
test/
|
156
|
-
test/
|
157
|
-
test/
|
158
|
-
test/
|
125
|
+
test/test_attr.rb
|
126
|
+
test/test_attr_decl.rb
|
127
|
+
test/test_attributes.rb
|
128
|
+
test/test_deprecated_require.rb
|
129
|
+
test/test_document.rb
|
130
|
+
test/test_document_write.rb
|
131
|
+
test/test_dtd.rb
|
132
|
+
test/test_error.rb
|
133
|
+
test/test_html_parser.rb
|
134
|
+
test/test_namespace.rb
|
135
|
+
test/test_namespaces.rb
|
136
|
+
test/test_node.rb
|
137
|
+
test/test_node_cdata.rb
|
138
|
+
test/test_node_comment.rb
|
139
|
+
test/test_node_copy.rb
|
140
|
+
test/test_node_edit.rb
|
141
|
+
test/test_node_pi.rb
|
142
|
+
test/test_node_text.rb
|
143
|
+
test/test_node_write.rb
|
144
|
+
test/test_node_xlink.rb
|
145
|
+
test/test_parser.rb
|
146
|
+
test/test_parser_context.rb
|
147
|
+
test/test_properties.rb
|
148
|
+
test/test_reader.rb
|
149
|
+
test/test_relaxng.rb
|
150
|
+
test/test_sax_parser.rb
|
151
|
+
test/test_schema.rb
|
152
|
+
test/test_traversal.rb
|
153
|
+
test/test_xinclude.rb
|
154
|
+
test/test_xml.rb
|
155
|
+
test/test_xpath.rb
|
156
|
+
test/test_xpath_context.rb
|
157
|
+
test/test_xpath_expression.rb
|
158
|
+
test/test_xpointer.rb
|
159
159
|
test/test_suite.rb
|
160
160
|
Rakefile
|
161
161
|
HISTORY.rdoc
|
data/README.rdoc
CHANGED
@@ -11,8 +11,8 @@ 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 1.8.
|
15
|
-
function
|
14
|
+
libxml-ruby requires Ruby 1.8.7 or higher. It depends on libxml2 to
|
15
|
+
function properly. libxml2, in turn, depends on:
|
16
16
|
|
17
17
|
* libm (math routines: very standard)
|
18
18
|
* libz (zlib)
|
@@ -21,25 +21,41 @@ function propoerly. libxml2, in turn, depends on:
|
|
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
23
|
Windows, then install the x64-mingw32 gem or build it yourself using
|
24
|
-
Devkit
|
25
|
-
msys2
|
24
|
+
Devkit[http://rubyinstaller.org/add-ons/devkit/] or
|
25
|
+
msys2[https://msys2.github.io/].
|
26
26
|
|
27
|
-
==
|
28
|
-
The easiest way to install libxml-ruby is via
|
27
|
+
== Installation
|
28
|
+
The easiest way to install libxml-ruby is via RubyGems. To install:
|
29
29
|
|
30
30
|
<tt>gem install libxml-ruby</tt>
|
31
31
|
|
32
|
+
If the extension compile process cannot find libxml2, you may need to indicate
|
33
|
+
the location of the libxml2 configuration utility as it is used to find the
|
34
|
+
required header and include files. (If you need to indicate a location for the
|
35
|
+
libxml2 library or header files different than reported by <tt>xml2-config</tt>,
|
36
|
+
see the additional configuration options.)
|
37
|
+
|
38
|
+
This may be done with RubyGems:
|
39
|
+
|
40
|
+
<tt>gem install libxml-ruby -- --with-xml2-dir=/path/to/xml2-config</tt>
|
41
|
+
|
42
|
+
Or bundler:
|
43
|
+
|
44
|
+
<tt>bundle config build.libxml-ruby --with-xml2-config=/path/to/xml2-config</tt>
|
45
|
+
|
46
|
+
<tt>bundle install libxml-ruby</tt>
|
47
|
+
|
32
48
|
If you are running Windows, then install the libxml-ruby-x64-mingw32 gem.
|
33
|
-
|
49
|
+
The gem includes prebuilt extensions for Ruby 2.3. These
|
34
50
|
extensions are built using MinGW64 and libxml2 version 2.9.3,
|
35
51
|
iconv version 1.14 and zlib version 1.2.8. Note these binaries
|
36
|
-
are available in the lib
|
37
|
-
|
52
|
+
are available in the <tt>lib\\libs</tt> directory. To use them, put them
|
53
|
+
on your <tt>PATH</tt>.
|
38
54
|
|
39
55
|
The gem also includes a Microsoft VC++ 2012 solution and XCode 5 project - these
|
40
56
|
are very useful for debugging.
|
41
57
|
|
42
|
-
libxml-ruby's source codes lives on
|
58
|
+
libxml-ruby's source codes lives on GitHub[https://github.com/xml4r/libxml-ruby].
|
43
59
|
|
44
60
|
== Getting Started
|
45
61
|
Using libxml is easy. First decide what parser you want to use:
|
@@ -60,7 +76,7 @@ Beyond the basics of parsing and processing XML and HTML documents,
|
|
60
76
|
libxml provides a wealth of additional functionality.
|
61
77
|
|
62
78
|
Most commonly, you'll want to use its LibXML::XML::XPath support, which makes
|
63
|
-
it easy to find data inside
|
79
|
+
it easy to find data inside an XML document. Although not as popular,
|
64
80
|
LibXML::XML::XPointer provides another API for finding data inside an XML document.
|
65
81
|
|
66
82
|
Often times you'll need to validate data before processing it. For example,
|
@@ -72,17 +88,16 @@ This can be done using libxml's powerful set of validators:
|
|
72
88
|
* Relax Schemas (LibXML::XML::RelaxNG)
|
73
89
|
* XML Schema (LibXML::XML::Schema)
|
74
90
|
|
75
|
-
Finally, if you'd like to use XSL Transformations to process data,
|
76
|
-
|
77
|
-
https://github.com/xml4r/libxslt-ruby.
|
91
|
+
Finally, if you'd like to use XSL Transformations to process data, then install
|
92
|
+
the {libxslt gem}[https://github.com/xml4r/libxslt-rubygem].
|
78
93
|
|
79
94
|
== Usage
|
80
|
-
For information about using libxml-ruby please refer to its
|
81
|
-
http://xml4r.github.
|
82
|
-
available
|
95
|
+
For information about using libxml-ruby please refer to its
|
96
|
+
documentation[http://xml4r.github.io/libxml-ruby]. Some tutorials are also
|
97
|
+
available[https://github.com/xml4r/libxml-ruby/wiki].
|
83
98
|
|
84
99
|
All libxml classes are in the LibXML::XML module. The easiest
|
85
|
-
way to use libxml is to require 'xml'
|
100
|
+
way to use libxml is to <tt>require 'xml'</tt>. This will mixin
|
86
101
|
the LibXML module into the global namespace, allowing you to
|
87
102
|
write code like this:
|
88
103
|
|
@@ -118,11 +133,24 @@ libxml-ruby fully supports native, background Ruby threads. This of course
|
|
118
133
|
only applies to Ruby 1.9.x and higher since earlier versions of Ruby do not
|
119
134
|
support native threads.
|
120
135
|
|
136
|
+
== Tests
|
137
|
+
|
138
|
+
To run tests you first need to build the shared libary:
|
139
|
+
|
140
|
+
rake compile
|
141
|
+
|
142
|
+
Once you have build the shared libary, you can then run tests using rake:
|
143
|
+
|
144
|
+
rake test
|
145
|
+
|
146
|
+
+Travis build status: {<img src="https://travis-ci.org/xml4r/libxml-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/xml4r/libxml-ruby]
|
147
|
+
|
121
148
|
== Performance
|
149
|
+
|
122
150
|
In addition to being feature rich and conformation, the main reason
|
123
|
-
people use libxml-ruby is for performance. Here are the results
|
151
|
+
people use libxml-ruby is for performance. Here are the results
|
124
152
|
of a couple simple benchmarks recently blogged about on the
|
125
|
-
Web (you can find them in the benchmark directory of the
|
153
|
+
Web (you can find them in the benchmark directory of the
|
126
154
|
libxml distribution).
|
127
155
|
|
128
156
|
From http://depixelate.com/2008/4/23/ruby-xml-parsing-benchmarks
|
@@ -144,44 +172,45 @@ From https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks/
|
|
144
172
|
Documentation is available via rdoc, and is installed automatically with the
|
145
173
|
gem.
|
146
174
|
|
147
|
-
libxml-ruby's online
|
148
|
-
|
175
|
+
libxml-ruby's {online
|
176
|
+
documentation}[https://xml4r.github.io/libxml-ruby/rdoc/index.html] is generated
|
177
|
+
using Hanna, which is a development gem dependency.
|
149
178
|
|
150
179
|
Note that older versions of Rdoc, which ship with Ruby 1.8.x, will report
|
151
180
|
a number of errors. To avoid them, install Rdoc 2.1 or higher. Once you have
|
152
181
|
installed the gem, you'll have to disable the version of Rdoc that Ruby 1.8.x
|
153
|
-
includes. An easy way to do that is rename the directory
|
154
|
-
ruby/lib/ruby/1.8/
|
182
|
+
includes. An easy way to do that is rename the directory
|
183
|
+
<tt>ruby/lib/ruby/1.8/rdoc</tt> to
|
184
|
+
<tt>ruby/lib/ruby/1.8/rdoc_old</tt>.
|
155
185
|
|
156
186
|
== Support
|
157
|
-
|
158
|
-
|
159
|
-
Git Hub at https://github.com/xml4r/libxml-ruby/issues
|
187
|
+
If you have any questions about using libxml-ruby, please report an issue
|
188
|
+
on GitHub[https://github.com/xml4r/libxml-ruby/issues].
|
160
189
|
|
161
190
|
== Memory Management
|
162
191
|
libxml-ruby automatically manages memory associated with the
|
163
192
|
underlying libxml2 library. The bindings create a one-to-one mapping between
|
164
|
-
|
165
|
-
have a parent and do not belong to a document).
|
193
|
+
Ruby objects and libxml documents and libxml parent nodes (ie, nodes that do not
|
194
|
+
have a parent and do not belong to a document). In these cases,
|
166
195
|
the bindings manage the memory. They do this by installing a free
|
167
196
|
function and storing a back pointer to the Ruby object from the xmlnode
|
168
197
|
using the _private member on libxml structures. When the Ruby object
|
169
198
|
goes out of scope, the underlying libxml structure is freed. Libxml
|
170
|
-
itself then frees all child
|
199
|
+
itself then frees all child nodes (recursively).
|
171
200
|
|
172
201
|
For all other nodes (the vast majority), the bindings create temporary
|
173
202
|
Ruby objects that get freed once they go out of scope. Thus there can be
|
174
|
-
more than one
|
175
|
-
this from
|
176
|
-
overriden to check if two
|
203
|
+
more than one Ruby object pointing to the same xml node. To mostly hide
|
204
|
+
this from a programmer on the Ruby side, the <tt>#eql?</tt> and <tt>#==</tt> methods are
|
205
|
+
overriden to check if two Ruby objects wrap the same xmlnode. If they do,
|
177
206
|
then the methods return true. During the mark phase, each of these temporary
|
178
207
|
objects marks its owning document, thereby keeping the Ruby document object
|
179
208
|
alive and thus the xmldoc tree.
|
180
209
|
|
181
210
|
In the sweep phase of the garbage collector, or when a program ends,
|
182
|
-
there is no order to how Ruby objects are freed.
|
183
|
-
object is almost always freed before any
|
184
|
-
However, this is ok because those
|
211
|
+
there is no order to how Ruby objects are freed. In fact, the Ruby document
|
212
|
+
object is almost always freed before any Ruby objects that wrap child nodes.
|
213
|
+
However, this is ok because those Ruby objects do not have a free function
|
185
214
|
and are no longer in scope (since if they were the document would not be freed).
|
186
215
|
|
187
216
|
== License
|
data/Rakefile
CHANGED
@@ -21,8 +21,25 @@ Rake::ExtensionTask.new do |ext|
|
|
21
21
|
ext.name = SO_NAME
|
22
22
|
ext.ext_dir = "ext/libxml"
|
23
23
|
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
|
24
|
-
|
25
|
-
|
24
|
+
if RUBY_PLATFORM.match(/mswin|mingw/)
|
25
|
+
ext.config_options <<
|
26
|
+
if (dir = ENV['WINDOWS_XML2_INCLUDE'])
|
27
|
+
"--with-xml2-include=#{dir}"
|
28
|
+
else
|
29
|
+
case RUBY_PLATFORM
|
30
|
+
when 'i386-mingw32'
|
31
|
+
'--with-xml2-include=C:/msys64/mingw32/include/libxml2'
|
32
|
+
when 'x64-mingw32'
|
33
|
+
'--with-xml2-include=C:/msys64/mingw64/include/libxml2'
|
34
|
+
when 'x64-mingw-ucrt'
|
35
|
+
'--with-xml2-include=C:/msys64/ucrt64/include/libxml2'
|
36
|
+
else
|
37
|
+
raise "Unknown Windows Ruby, please set ENV['WINDOWS_XML2_INCLUDE']"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
else
|
41
|
+
ext.config_options << '--with-xml2-include=/usr/include/libxml2'
|
42
|
+
end
|
26
43
|
end
|
27
44
|
|
28
45
|
# Setup generic gem
|
@@ -32,7 +49,7 @@ Gem::PackageTask.new(spec) do |pkg|
|
|
32
49
|
end
|
33
50
|
|
34
51
|
# Setup Windows Gem
|
35
|
-
if RUBY_PLATFORM.match(/
|
52
|
+
if RUBY_PLATFORM.match(/mswin|mingw/)
|
36
53
|
binaries = (FileList['lib/**/*.so',
|
37
54
|
'lib/**/*dll'])
|
38
55
|
|
@@ -77,5 +94,6 @@ end
|
|
77
94
|
# Test Task
|
78
95
|
Rake::TestTask.new do |t|
|
79
96
|
t.libs << "test"
|
97
|
+
t.test_files = FileList['test/test*.rb'] - ['test/test_suite.rb']
|
80
98
|
t.verbose = true
|
81
99
|
end
|
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);
|
@@ -483,7 +483,6 @@ static VALUE rxml_document_encoding_get(VALUE self)
|
|
483
483
|
* Returns the Ruby encoding specified by this document
|
484
484
|
* (available on Ruby 1.9.x and higher).
|
485
485
|
*/
|
486
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
487
486
|
static VALUE rxml_document_rb_encoding_get(VALUE self)
|
488
487
|
{
|
489
488
|
xmlDocPtr xdoc;
|
@@ -493,7 +492,6 @@ static VALUE rxml_document_rb_encoding_get(VALUE self)
|
|
493
492
|
rbencoding = rxml_xml_encoding_to_rb_encoding(mXMLEncoding, xmlParseCharEncoding((const char*)xdoc->encoding));
|
494
493
|
return rb_enc_from_encoding(rbencoding);
|
495
494
|
}
|
496
|
-
#endif
|
497
495
|
|
498
496
|
/*
|
499
497
|
* call-seq:
|
@@ -738,7 +736,7 @@ static VALUE rxml_document_root_set(VALUE self, VALUE node)
|
|
738
736
|
Data_Get_Struct(node, xmlNode, xnode);
|
739
737
|
|
740
738
|
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");
|
739
|
+
rb_raise(eXMLError, "Nodes belong to different documents. You must first import the node by calling LibXML::XML::Document.import");
|
742
740
|
|
743
741
|
xmlDocSetRootElement(xdoc, xnode);
|
744
742
|
|
@@ -1097,9 +1095,7 @@ void rxml_init_document(void)
|
|
1097
1095
|
rb_define_method(cXMLDocument, "compression?", rxml_document_compression_q, 0);
|
1098
1096
|
rb_define_method(cXMLDocument, "debug", rxml_document_debug, 0);
|
1099
1097
|
rb_define_method(cXMLDocument, "encoding", rxml_document_encoding_get, 0);
|
1100
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
1101
1098
|
rb_define_method(cXMLDocument, "rb_encoding", rxml_document_rb_encoding_get, 0);
|
1102
|
-
#endif
|
1103
1099
|
rb_define_method(cXMLDocument, "encoding=", rxml_document_encoding_set, 1);
|
1104
1100
|
rb_define_method(cXMLDocument, "import", rxml_document_import, 1);
|
1105
1101
|
rb_define_method(cXMLDocument, "last", rxml_document_last_get, 0);
|
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
|
|
@@ -74,7 +74,6 @@ static VALUE rxml_encoding_to_s(VALUE klass, VALUE encoding)
|
|
74
74
|
return rxml_new_cstr(xencoding, xencoding);
|
75
75
|
}
|
76
76
|
|
77
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
78
77
|
/*
|
79
78
|
* Converts an xmlCharEncoding enum value into a Ruby Encoding object (available
|
80
79
|
* on Ruby 1.9.* and higher).
|
@@ -179,26 +178,17 @@ rb_encoding* rxml_figure_encoding(const xmlChar* xencoding)
|
|
179
178
|
}
|
180
179
|
return result;
|
181
180
|
}
|
182
|
-
#endif
|
183
181
|
|
184
182
|
VALUE rxml_new_cstr(const xmlChar* xstr, const xmlChar* xencoding)
|
185
183
|
{
|
186
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
187
184
|
rb_encoding *rbencoding = rxml_figure_encoding(xencoding);
|
188
185
|
return rb_external_str_new_with_enc((const char*)xstr, strlen((const char*)xstr), rbencoding);
|
189
|
-
#else
|
190
|
-
return rb_str_new2((const char*)xstr);
|
191
|
-
#endif
|
192
186
|
}
|
193
187
|
|
194
188
|
VALUE rxml_new_cstr_len(const xmlChar* xstr, const long length, const xmlChar* xencoding)
|
195
189
|
{
|
196
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
197
190
|
rb_encoding *rbencoding = rxml_figure_encoding(xencoding);
|
198
191
|
return rb_external_str_new_with_enc((const char*)xstr, length, rbencoding);
|
199
|
-
#else
|
200
|
-
return rb_str_new((const char*)xstr, length);
|
201
|
-
#endif
|
202
192
|
}
|
203
193
|
|
204
194
|
void rxml_init_encoding(void)
|
@@ -207,9 +197,7 @@ void rxml_init_encoding(void)
|
|
207
197
|
rb_define_module_function(mXMLEncoding, "from_s", rxml_encoding_from_s, 1);
|
208
198
|
rb_define_module_function(mXMLEncoding, "to_s", rxml_encoding_to_s, 1);
|
209
199
|
|
210
|
-
|
211
|
-
// rb_define_module_function(mXMLEncoding, "to_rb_encoding", rxml_encoding_to_rb_encoding, 2);
|
212
|
-
#endif
|
200
|
+
rb_define_module_function(mXMLEncoding, "to_rb_encoding", rxml_encoding_to_rb_encoding, 2);
|
213
201
|
|
214
202
|
/* -1: No char encoding detected. */
|
215
203
|
rb_define_const(mXMLEncoding, "ERROR", INT2NUM(XML_CHAR_ENCODING_ERROR));
|
@@ -7,13 +7,10 @@ extern VALUE mXMLEncoding;
|
|
7
7
|
|
8
8
|
void rxml_init_encoding();
|
9
9
|
|
10
|
-
// Ruby 1.8/1.9 encoding compatibility
|
11
10
|
VALUE rxml_new_cstr(const xmlChar* xstr, const xmlChar* xencoding);
|
12
11
|
VALUE rxml_new_cstr_len(const xmlChar* xstr, const long length, const xmlChar* xencoding);
|
13
12
|
|
14
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
15
13
|
rb_encoding* rxml_xml_encoding_to_rb_encoding(VALUE klass, xmlCharEncoding xmlEncoding);
|
16
14
|
rb_encoding* rxml_figure_encoding(const xmlChar* xencoding);
|
17
|
-
#endif
|
18
15
|
|
19
16
|
#endif
|
data/ext/libxml/ruby_xml_error.c
CHANGED
@@ -158,7 +158,7 @@ static VALUE rxml_error_reset_handler(VALUE self)
|
|
158
158
|
return self;
|
159
159
|
}
|
160
160
|
|
161
|
-
void rxml_raise(xmlErrorPtr xerror)
|
161
|
+
NORETURN(void rxml_raise(xmlErrorPtr xerror))
|
162
162
|
{
|
163
163
|
/* Wrap error up as Ruby object and send it off to ruby */
|
164
164
|
VALUE error = rxml_error_wrap(xerror);
|