libxml-ruby 5.0.5 → 6.0.0
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 → CHANGELOG.md} +875 -923
- data/LICENSE +20 -20
- data/README.md +67 -0
- data/Rakefile +77 -98
- data/ext/libxml/extconf.rb +34 -20
- data/ext/libxml/libxml.c +67 -79
- data/ext/libxml/ruby_libxml.h +1 -1
- data/ext/libxml/ruby_xml_attr.c +338 -333
- data/ext/libxml/ruby_xml_attr.h +13 -12
- data/ext/libxml/ruby_xml_attr_decl.c +19 -12
- data/ext/libxml/ruby_xml_attr_decl.h +11 -11
- data/ext/libxml/ruby_xml_attributes.c +18 -9
- data/ext/libxml/ruby_xml_document.c +111 -98
- data/ext/libxml/ruby_xml_document.h +1 -0
- data/ext/libxml/ruby_xml_dtd.c +49 -19
- data/ext/libxml/ruby_xml_dtd.h +10 -9
- data/ext/libxml/ruby_xml_html_parser.c +91 -91
- data/ext/libxml/ruby_xml_html_parser.h +10 -10
- data/ext/libxml/ruby_xml_html_parser_context.c +19 -6
- data/ext/libxml/ruby_xml_html_parser_context.h +11 -10
- data/ext/libxml/ruby_xml_html_parser_options.c +48 -48
- data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
- data/ext/libxml/ruby_xml_input_cbg.c +45 -17
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_io.c +49 -47
- data/ext/libxml/ruby_xml_io.h +10 -10
- data/ext/libxml/ruby_xml_namespace.c +20 -12
- data/ext/libxml/ruby_xml_namespace.h +11 -10
- data/ext/libxml/ruby_xml_namespaces.c +313 -293
- data/ext/libxml/ruby_xml_namespaces.h +9 -9
- data/ext/libxml/ruby_xml_node.c +71 -32
- data/ext/libxml/ruby_xml_node.h +15 -13
- data/ext/libxml/ruby_xml_parser.c +91 -91
- data/ext/libxml/ruby_xml_parser_context.c +54 -47
- data/ext/libxml/ruby_xml_parser_context.h +11 -10
- data/ext/libxml/ruby_xml_reader.c +25 -15
- data/ext/libxml/ruby_xml_reader.h +14 -14
- data/ext/libxml/ruby_xml_registry.c +31 -0
- data/ext/libxml/ruby_xml_registry.h +22 -0
- data/ext/libxml/ruby_xml_relaxng.c +21 -5
- data/ext/libxml/ruby_xml_relaxng.h +9 -8
- data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
- data/ext/libxml/ruby_xml_sax_parser.c +1 -1
- data/ext/libxml/ruby_xml_sax_parser.h +10 -10
- data/ext/libxml/ruby_xml_schema.c +18 -11
- data/ext/libxml/ruby_xml_schema.h +26 -25
- data/ext/libxml/ruby_xml_schema_attribute.c +7 -7
- data/ext/libxml/ruby_xml_schema_attribute.h +37 -37
- data/ext/libxml/ruby_xml_schema_element.c +8 -8
- data/ext/libxml/ruby_xml_schema_element.h +11 -11
- data/ext/libxml/ruby_xml_schema_facet.c +50 -50
- data/ext/libxml/ruby_xml_schema_facet.h +9 -9
- data/ext/libxml/ruby_xml_schema_type.c +12 -19
- data/ext/libxml/ruby_xml_schema_type.h +9 -9
- data/ext/libxml/ruby_xml_version.h +4 -4
- data/ext/libxml/ruby_xml_writer.c +1136 -1124
- data/ext/libxml/ruby_xml_writer.h +6 -6
- data/ext/libxml/ruby_xml_xinclude.c +20 -20
- data/ext/libxml/ruby_xml_xinclude.h +11 -11
- data/ext/libxml/ruby_xml_xpath.c +195 -195
- data/ext/libxml/ruby_xml_xpath.h +15 -15
- data/ext/libxml/ruby_xml_xpath_context.c +408 -362
- data/ext/libxml/ruby_xml_xpath_context.h +9 -9
- data/ext/libxml/ruby_xml_xpath_expression.c +11 -5
- data/ext/libxml/ruby_xml_xpath_expression.h +11 -10
- data/ext/libxml/ruby_xml_xpath_object.c +69 -54
- data/ext/libxml/ruby_xml_xpath_object.h +19 -17
- data/ext/vc/libxml_ruby/libxml_ruby.vcxproj +271 -0
- data/ext/xcode/libxml-ruby.xcodeproj/project.pbxproj +633 -0
- data/ext/xcode/libxml-ruby.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/ext/xcode/libxml-ruby.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/ext/xcode/libxml-ruby.xcodeproj/xcshareddata/xcschemes/libxml-ruby.xcscheme +80 -0
- data/lib/libxml/document.rb +0 -29
- data/lib/libxml/error.rb +30 -3
- data/lib/libxml/html_parser.rb +0 -16
- data/lib/libxml/node.rb +1 -3
- data/lib/libxml/parser.rb +0 -8
- data/lib/libxml/schema/attribute.rb +27 -19
- data/lib/libxml/schema/element.rb +20 -0
- data/lib/libxml/schema/type.rb +44 -21
- data/lib/libxml/schema.rb +47 -47
- data/lib/libxml-ruby.rb +30 -30
- data/libxml-ruby.gemspec +12 -16
- data/test/c14n/result/1-1-without-comments/example-1 +3 -3
- data/test/c14n/result/1-1-without-comments/example-2 +10 -10
- data/test/c14n/result/1-1-without-comments/example-3 +13 -13
- data/test/c14n/result/1-1-without-comments/example-4 +8 -8
- data/test/c14n/result/1-1-without-comments/example-5 +2 -2
- data/test/c14n/result/with-comments/example-1 +5 -5
- data/test/c14n/result/with-comments/example-2 +10 -10
- data/test/c14n/result/with-comments/example-3 +13 -13
- data/test/c14n/result/with-comments/example-4 +8 -8
- data/test/c14n/result/with-comments/example-5 +3 -3
- data/test/c14n/result/without-comments/example-1 +3 -3
- data/test/c14n/result/without-comments/example-2 +10 -10
- data/test/c14n/result/without-comments/example-3 +13 -13
- data/test/c14n/result/without-comments/example-4 +8 -8
- data/test/c14n/result/without-comments/example-5 +2 -2
- data/test/test_attr.rb +179 -180
- data/test/test_attr_decl.rb +131 -131
- data/test/test_attributes.rb +135 -135
- data/test/test_canonicalize.rb +122 -120
- data/test/test_document.rb +2 -4
- data/test/test_dtd.rb +12 -4
- data/test/test_encoding_sax.rb +114 -114
- data/test/test_error.rb +6 -3
- data/test/test_helper.rb +1 -0
- data/test/test_html_parser.rb +6 -2
- data/test/test_html_parser_context.rb +22 -22
- data/test/test_input_callbacks.rb +36 -0
- data/test/test_namespace.rb +1 -1
- data/test/test_namespaces.rb +200 -200
- data/test/test_node.rb +16 -0
- data/test/test_node_cdata.rb +50 -50
- data/test/test_node_comment.rb +32 -32
- data/test/test_node_copy.rb +40 -40
- data/test/test_node_edit.rb +176 -158
- data/test/test_node_pi.rb +37 -37
- data/test/test_node_text.rb +69 -69
- data/test/test_node_xlink.rb +28 -28
- data/test/test_parser.rb +5 -41
- data/test/test_parser_context.rb +198 -198
- data/test/test_properties.rb +38 -38
- data/test/test_reader.rb +55 -6
- data/test/test_relaxng.rb +59 -53
- data/test/test_sax_parser.rb +345 -345
- data/test/test_schema.rb +28 -0
- data/test/test_traversal.rb +152 -152
- data/test/test_writer.rb +469 -468
- data/test/test_xinclude.rb +20 -20
- data/test/test_xml.rb +3 -7
- data/test/test_xpath.rb +244 -244
- data/test/test_xpath_context.rb +87 -87
- data/test/test_xpath_expression.rb +37 -37
- metadata +33 -27
- data/README.rdoc +0 -208
- data/ext/libxml/extconf.h +0 -3
- data/ext/libxml/ruby_xml_cbg.c +0 -85
- data/lib/libxml/hpricot.rb +0 -78
- data/lib/libxml.rb +0 -5
- data/lib/xml/libxml.rb +0 -10
- data/lib/xml.rb +0 -14
- data/script/benchmark/depixelate +0 -634
- data/script/benchmark/hamlet.xml +0 -9055
- data/script/benchmark/parsecount +0 -170
- data/script/benchmark/sock_entries.xml +0 -507
- data/script/benchmark/throughput +0 -41
- data/script/test +0 -6
- data/test/test.rb +0 -5
- data/test/test_deprecated_require.rb +0 -12
data/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
Copyright (c) 2008-2013 Charlie Savage and contributors
|
|
2
|
-
Copyright (c) 2002-2007 Sean Chittenden and contributors
|
|
3
|
-
Copyright (c) 2001 Wai-Sun "Squidster" Chia
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
-
so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
Copyright (c) 2008-2013 Charlie Savage and contributors
|
|
2
|
+
Copyright (c) 2002-2007 Sean Chittenden and contributors
|
|
3
|
+
Copyright (c) 2001 Wai-Sun "Squidster" Chia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# LibXML Ruby
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
The libxml gem provides Ruby language bindings for GNOME's Libxml2
|
|
5
|
+
XML toolkit. It is free software, released under the MIT License.
|
|
6
|
+
|
|
7
|
+
libxml-ruby let's you:
|
|
8
|
+
|
|
9
|
+
* Read xml files
|
|
10
|
+
* Write xml files
|
|
11
|
+
* Search xml files using XPath
|
|
12
|
+
* Validate XML files
|
|
13
|
+
|
|
14
|
+
Full documentation is available at [xml4r.github.io/libxml-ruby](https://xml4r.github.io/libxml-ruby/) including a getting started guide.
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
libxml-ruby requires Ruby 3.2 or higher.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
The easiest way to install libxml-ruby is via RubyGems. To install:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
gem install libxml-ruby
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If the extension compile process cannot find libxml2, you may need to indicate
|
|
28
|
+
the location of the libxml2 configuration utility as it is used to find the
|
|
29
|
+
required header and include files. (If you need to indicate a location for the
|
|
30
|
+
libxml2 library or header files different than reported by `xml2-config`,
|
|
31
|
+
see the additional configuration options.)
|
|
32
|
+
|
|
33
|
+
This may be done with RubyGems:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
gem install libxml-ruby -- --with-xml2-config=/path/to/xml2-config
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or bundler:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
bundle config build.libxml-ruby --with-xml2-config=/path/to/xml2-config
|
|
43
|
+
bundle install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Full documentation is available at [xml4r.github.io/libxml-ruby](https://xml4r.github.io/libxml-ruby/) including a [getting started](https://xml4r.github.io/libxml-ruby/getting_started/) guide.
|
|
47
|
+
|
|
48
|
+
## Tests
|
|
49
|
+
|
|
50
|
+
To run tests you first need to build the shared library:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
rake compile
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Once you have built the shared library, you can then run tests using rake:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
rake test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Support
|
|
63
|
+
If you have any questions about using libxml-ruby, please report an issue
|
|
64
|
+
on [GitHub](https://github.com/xml4r/libxml-ruby/issues).
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
See [LICENSE](LICENSE) for license information.
|
data/Rakefile
CHANGED
|
@@ -1,99 +1,78 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "rubygems"
|
|
4
|
-
require "rake/extensiontask"
|
|
5
|
-
require "rake/testtask"
|
|
6
|
-
require "rubygems/package_task"
|
|
7
|
-
require "rdoc/task"
|
|
8
|
-
require "yaml"
|
|
9
|
-
|
|
10
|
-
GEM_NAME = "libxml-ruby"
|
|
11
|
-
SO_NAME = "libxml_ruby"
|
|
12
|
-
|
|
13
|
-
# Read the spec file
|
|
14
|
-
spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
|
15
|
-
|
|
16
|
-
task :default => [:test]
|
|
17
|
-
|
|
18
|
-
# Setup compile tasks
|
|
19
|
-
Rake::ExtensionTask.new do |ext|
|
|
20
|
-
ext.gem_spec = spec
|
|
21
|
-
ext.name = SO_NAME
|
|
22
|
-
ext.ext_dir = "ext/libxml"
|
|
23
|
-
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
#
|
|
46
|
-
Gem::PackageTask.new(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# Show source inline with line numbers
|
|
80
|
-
rdoc.options << '--line-numbers'
|
|
81
|
-
rdoc.options << '--charset=utf-8'
|
|
82
|
-
# Make the readme file the start page for the generated html
|
|
83
|
-
rdoc.main = 'README.rdoc'
|
|
84
|
-
rdoc.rdoc_files.include('doc/*.rdoc',
|
|
85
|
-
'ext/**/libxml.c',
|
|
86
|
-
'ext/**/ruby_xml.c',
|
|
87
|
-
'ext/**/*.c',
|
|
88
|
-
'lib/**/*.rb',
|
|
89
|
-
'README.rdoc',
|
|
90
|
-
'HISTORY',
|
|
91
|
-
'LICENSE')
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# Test Task
|
|
95
|
-
Rake::TestTask.new do |t|
|
|
96
|
-
t.libs << "test"
|
|
97
|
-
t.test_files = FileList['test/test*.rb'] - ['test/test_suite.rb']
|
|
98
|
-
t.verbose = true
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "rubygems"
|
|
4
|
+
require "rake/extensiontask"
|
|
5
|
+
require "rake/testtask"
|
|
6
|
+
require "rubygems/package_task"
|
|
7
|
+
require "rdoc/task"
|
|
8
|
+
require "yaml"
|
|
9
|
+
|
|
10
|
+
GEM_NAME = "libxml-ruby"
|
|
11
|
+
SO_NAME = "libxml_ruby"
|
|
12
|
+
|
|
13
|
+
# Read the spec file
|
|
14
|
+
spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
|
15
|
+
|
|
16
|
+
task :default => [:test]
|
|
17
|
+
|
|
18
|
+
# Setup compile tasks
|
|
19
|
+
Rake::ExtensionTask.new do |ext|
|
|
20
|
+
ext.gem_spec = spec
|
|
21
|
+
ext.name = SO_NAME
|
|
22
|
+
ext.ext_dir = "ext/libxml"
|
|
23
|
+
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d+$/, '')}"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Setup generic gem
|
|
27
|
+
Gem::PackageTask.new(spec) do |pkg|
|
|
28
|
+
pkg.package_dir = 'pkg'
|
|
29
|
+
pkg.need_tar = false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Setup Windows Gem
|
|
33
|
+
if RUBY_PLATFORM.match(/mingw/)
|
|
34
|
+
binaries = (FileList['lib/**/*.so'])
|
|
35
|
+
|
|
36
|
+
# Windows specification
|
|
37
|
+
mingw_spec = spec.clone
|
|
38
|
+
mingw_spec.platform = Gem::Platform::CURRENT
|
|
39
|
+
mingw_spec.files += binaries.to_a
|
|
40
|
+
mingw_spec.instance_variable_set(:@cache_file, nil)
|
|
41
|
+
|
|
42
|
+
# Unset extensions
|
|
43
|
+
mingw_spec.extensions = nil
|
|
44
|
+
|
|
45
|
+
# Rake task to build the windows package
|
|
46
|
+
Gem::PackageTask.new(mingw_spec) do |pkg|
|
|
47
|
+
pkg.package_dir = 'pkg'
|
|
48
|
+
pkg.need_tar = false
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# RDoc Task
|
|
53
|
+
desc 'Generate rdoc documentation'
|
|
54
|
+
RDoc::Task.new("rdoc") do |rdoc|
|
|
55
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
56
|
+
rdoc.title = 'LibXML'
|
|
57
|
+
rdoc.generator = 'aliki'
|
|
58
|
+
|
|
59
|
+
# Show source inline with line numbers
|
|
60
|
+
rdoc.options << '--line-numbers'
|
|
61
|
+
rdoc.options << '--charset=utf-8'
|
|
62
|
+
# Make the readme file the start page for the generated html
|
|
63
|
+
rdoc.main = 'README.md'
|
|
64
|
+
rdoc.rdoc_files.include('ext/**/libxml.c',
|
|
65
|
+
'ext/**/ruby_xml.c',
|
|
66
|
+
'ext/**/*.c',
|
|
67
|
+
'lib/**/*.rb',
|
|
68
|
+
'README.md',
|
|
69
|
+
'CHANGELOG.md',
|
|
70
|
+
'LICENSE')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Test Task
|
|
74
|
+
Rake::TestTask.new do |t|
|
|
75
|
+
t.libs << "test"
|
|
76
|
+
t.test_files = FileList['test/test*.rb'] - ['test/test_suite.rb']
|
|
77
|
+
t.verbose = true
|
|
99
78
|
end
|
data/ext/libxml/extconf.rb
CHANGED
|
@@ -23,32 +23,46 @@ if xc
|
|
|
23
23
|
end
|
|
24
24
|
else
|
|
25
25
|
dir_config('xml2')
|
|
26
|
+
pkg_config('libxml-2.0')
|
|
26
27
|
end
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
include_dirs = []
|
|
30
|
+
lib_dirs = []
|
|
31
|
+
|
|
32
|
+
if (msystem_prefix = ENV['MSYSTEM_PREFIX']) && !msystem_prefix.empty?
|
|
33
|
+
include_dirs.concat([
|
|
34
|
+
"#{msystem_prefix}/include/libxml2",
|
|
35
|
+
"#{msystem_prefix}/include"
|
|
36
|
+
])
|
|
37
|
+
lib_dirs << "#{msystem_prefix}/lib"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
include_dirs.concat([
|
|
41
|
+
'/opt/include/libxml2',
|
|
42
|
+
'/opt/local/include/libxml2',
|
|
43
|
+
'/opt/homebrew/opt/libxml2/include/libxml2',
|
|
44
|
+
'/usr/local/include/libxml2',
|
|
45
|
+
'/usr/include/libxml2',
|
|
46
|
+
'/usr/local/include',
|
|
47
|
+
'/usr/local/opt/libxml2/include/libxml2'
|
|
48
|
+
])
|
|
49
|
+
|
|
50
|
+
lib_dirs.concat([
|
|
51
|
+
'/opt/lib',
|
|
52
|
+
'/opt/local/lib',
|
|
53
|
+
'/opt/homebrew/opt/libxml2/lib',
|
|
54
|
+
'/usr/lib',
|
|
55
|
+
'/usr/local/lib',
|
|
56
|
+
'/usr/local/opt/libxml2/lib'
|
|
57
|
+
])
|
|
58
|
+
|
|
59
|
+
found_header = find_header('libxml/xmlversion.h', *include_dirs)
|
|
36
60
|
|
|
37
61
|
found_lib = find_library('xml2', 'xmlParseDoc',
|
|
38
|
-
|
|
39
|
-
'/opt/local/lib',
|
|
40
|
-
'/opt/homebrew/opt/libxml2/lib',
|
|
41
|
-
'/usr/lib',
|
|
42
|
-
'/usr/local/lib',
|
|
43
|
-
'/usr/local/opt/libxml2/lib')
|
|
62
|
+
*lib_dirs)
|
|
44
63
|
|
|
45
64
|
found_lib ||= find_library('libxml2', 'xmlParseDoc',
|
|
46
|
-
|
|
47
|
-
'/opt/local/lib',
|
|
48
|
-
'/opt/homebrew/opt/libxml2/lib',
|
|
49
|
-
'/usr/lib',
|
|
50
|
-
'/usr/local/lib',
|
|
51
|
-
'/usr/local/opt/libxml2/lib')
|
|
65
|
+
*lib_dirs)
|
|
52
66
|
|
|
53
67
|
if !found_header || !found_lib
|
|
54
68
|
crash(<<~EOL)
|
data/ext/libxml/libxml.c
CHANGED
|
@@ -1,79 +1,67 @@
|
|
|
1
|
-
#include "ruby_libxml.h"
|
|
2
|
-
|
|
3
|
-
#if RUBY_INTERN_H
|
|
4
|
-
#include <ruby/util.h>
|
|
5
|
-
#else
|
|
6
|
-
#include <util.h>
|
|
7
|
-
#endif
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
VALUE mLibXML;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
rxml_init_xpath_context();
|
|
69
|
-
rxml_init_xpath_expression();
|
|
70
|
-
rxml_init_html_parser();
|
|
71
|
-
rxml_init_html_parser_options();
|
|
72
|
-
rxml_init_html_parser_context();
|
|
73
|
-
rxml_init_input_callbacks();
|
|
74
|
-
rxml_init_dtd();
|
|
75
|
-
rxml_init_schema();
|
|
76
|
-
rxml_init_relaxng();
|
|
77
|
-
rxml_init_reader();
|
|
78
|
-
rxml_init_writer();
|
|
79
|
-
}
|
|
1
|
+
#include "ruby_libxml.h"
|
|
2
|
+
|
|
3
|
+
#if RUBY_INTERN_H
|
|
4
|
+
#include <ruby/util.h>
|
|
5
|
+
#else
|
|
6
|
+
#include <util.h>
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
VALUE mLibXML;
|
|
11
|
+
|
|
12
|
+
void Init_libxml_ruby(void)
|
|
13
|
+
{
|
|
14
|
+
/* The libxml gem provides Ruby language bindings for GNOME's Libxml2
|
|
15
|
+
* XML toolkit. To get started you may:
|
|
16
|
+
*
|
|
17
|
+
* require 'test_helper'
|
|
18
|
+
* document = XML::Document.new
|
|
19
|
+
*
|
|
20
|
+
* However, when creating an application or library you plan to
|
|
21
|
+
* redistribute, it is best to not add the LibXML module to the global
|
|
22
|
+
* namespace, in which case you can either write your code like this:
|
|
23
|
+
*
|
|
24
|
+
* require 'libxml'
|
|
25
|
+
* document = LibXML::XML::Document.new
|
|
26
|
+
*
|
|
27
|
+
* Refer to the README file to get started and the LICENSE file for
|
|
28
|
+
* copyright and distribution information.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// Setup for threading. http://xmlsoft.org/threads.html
|
|
32
|
+
xmlInitParser();
|
|
33
|
+
|
|
34
|
+
mLibXML = rb_define_module("LibXML");
|
|
35
|
+
|
|
36
|
+
rxml_init_registry();
|
|
37
|
+
rxml_init_xml();
|
|
38
|
+
rxml_init_io();
|
|
39
|
+
rxml_init_error();
|
|
40
|
+
rxml_init_encoding();
|
|
41
|
+
rxml_init_parser();
|
|
42
|
+
rxml_init_parser_context();
|
|
43
|
+
rxml_init_parser_options();
|
|
44
|
+
rxml_init_node();
|
|
45
|
+
rxml_init_attributes();
|
|
46
|
+
rxml_init_attr();
|
|
47
|
+
rxml_init_attr_decl();
|
|
48
|
+
rxml_init_document();
|
|
49
|
+
rxml_init_namespaces();
|
|
50
|
+
rxml_init_namespace();
|
|
51
|
+
rxml_init_sax_parser();
|
|
52
|
+
rxml_init_sax2_handler();
|
|
53
|
+
rxml_init_xinclude();
|
|
54
|
+
rxml_init_xpath();
|
|
55
|
+
rxml_init_xpath_object();
|
|
56
|
+
rxml_init_xpath_context();
|
|
57
|
+
rxml_init_xpath_expression();
|
|
58
|
+
rxml_init_html_parser();
|
|
59
|
+
rxml_init_html_parser_options();
|
|
60
|
+
rxml_init_html_parser_context();
|
|
61
|
+
rxml_init_input_callbacks();
|
|
62
|
+
rxml_init_dtd();
|
|
63
|
+
rxml_init_schema();
|
|
64
|
+
rxml_init_relaxng();
|
|
65
|
+
rxml_init_reader();
|
|
66
|
+
rxml_init_writer();
|
|
67
|
+
}
|
data/ext/libxml/ruby_libxml.h
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
#include "ruby_xml_html_parser_options.h"
|
|
25
25
|
#include "ruby_xml_html_parser_context.h"
|
|
26
26
|
#include "ruby_xml_reader.h"
|
|
27
|
-
#include "ruby_xml_writer.h"
|
|
28
27
|
#include "ruby_xml_sax2_handler.h"
|
|
29
28
|
#include "ruby_xml_sax_parser.h"
|
|
30
29
|
#include "ruby_xml_writer.h"
|
|
@@ -37,6 +36,7 @@
|
|
|
37
36
|
#include "ruby_xml_dtd.h"
|
|
38
37
|
#include "ruby_xml_schema.h"
|
|
39
38
|
#include "ruby_xml_relaxng.h"
|
|
39
|
+
#include "ruby_xml_registry.h"
|
|
40
40
|
|
|
41
41
|
extern VALUE mLibXML;
|
|
42
42
|
|