libxml-ruby 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +23 -23
- data/README +144 -144
- data/ext/libxml/extconf.rb +26 -27
- data/ext/libxml/libxml.c +7 -37
- data/ext/libxml/{libxml.h → ruby_libxml.h} +93 -98
- data/ext/libxml/ruby_xml_attr.c +405 -387
- data/ext/libxml/ruby_xml_attr.h +19 -18
- data/ext/libxml/ruby_xml_document.c +1111 -1115
- data/ext/libxml/ruby_xml_document.h +27 -24
- data/ext/libxml/ruby_xml_dtd.c +168 -168
- data/ext/libxml/ruby_xml_html_parser.c +449 -450
- data/ext/libxml/ruby_xml_html_parser.h +1 -1
- data/ext/libxml/ruby_xml_input_cbg.c +158 -158
- data/ext/libxml/ruby_xml_node.c +2410 -2395
- data/ext/libxml/ruby_xml_node.h +1 -1
- data/ext/libxml/ruby_xml_node_set.c +170 -170
- data/ext/libxml/ruby_xml_node_set.h +1 -1
- data/ext/libxml/ruby_xml_ns.c +153 -153
- data/ext/libxml/ruby_xml_ns.h +1 -1
- data/ext/libxml/ruby_xml_parser.c +1425 -1422
- data/ext/libxml/ruby_xml_parser.h +1 -1
- data/ext/libxml/ruby_xml_parser_context.c +750 -716
- data/ext/libxml/ruby_xml_parser_context.h +1 -1
- data/ext/libxml/ruby_xml_reader.c +900 -896
- data/ext/libxml/ruby_xml_sax_parser.c +485 -485
- data/ext/libxml/ruby_xml_sax_parser.h +1 -1
- data/ext/libxml/ruby_xml_schema.c +146 -142
- data/ext/libxml/ruby_xml_state.c +5 -6
- data/ext/libxml/ruby_xml_state.h +1 -0
- data/ext/libxml/ruby_xml_tree.c +43 -43
- data/ext/libxml/ruby_xml_tree.h +1 -1
- data/ext/libxml/ruby_xml_xinclude.c +20 -20
- data/ext/libxml/ruby_xml_xinclude.h +1 -1
- data/ext/libxml/ruby_xml_xpath.c +243 -252
- data/ext/libxml/ruby_xml_xpath.h +1 -1
- data/ext/libxml/ruby_xml_xpath_context.c +118 -118
- data/ext/libxml/ruby_xml_xpath_context.h +1 -1
- data/ext/libxml/ruby_xml_xpath_object.c +43 -29
- data/ext/libxml/ruby_xml_xpath_object.h +0 -1
- data/ext/libxml/ruby_xml_xpointer.c +100 -100
- data/ext/libxml/ruby_xml_xpointer.h +1 -1
- data/ext/libxml/ruby_xml_xpointer_context.c +21 -21
- data/ext/libxml/ruby_xml_xpointer_context.h +1 -1
- data/ext/libxml/sax_parser_callbacks.inc +213 -213
- data/ext/libxml/version.h +9 -9
- data/lib/libxml.rb +24 -3
- data/mingw/libiconv-2.dll +0 -0
- data/mingw/libxml2-2.dll +0 -0
- data/mingw/libxml_ruby.so +0 -0
- data/mingw/mingw.rake +36 -0
- data/test/dtd-test.rb +24 -24
- data/test/etc_doc_to_s.rb +1 -3
- data/test/ets_copy_bug.rb +21 -21
- data/test/ets_copy_bug2.rb +32 -32
- data/test/ets_copy_bug3.rb +38 -0
- data/test/ets_doc_file.rb +1 -0
- data/test/{model/default_validation_bug.rb → gc.log} +0 -0
- data/test/merge_bug.rb +55 -55
- data/test/schema-test.rb +74 -74
- data/test/tc_well_formed.rb +11 -0
- data/test/tc_xml_document.rb +52 -52
- data/test/tc_xml_document_write.rb +24 -24
- data/test/tc_xml_document_write2.rb +54 -54
- data/test/tc_xml_document_write3.rb +96 -96
- data/test/tc_xml_html_parser.rb +63 -63
- data/test/tc_xml_node.rb +59 -59
- data/test/tc_xml_node2.rb +25 -25
- data/test/tc_xml_node3.rb +27 -27
- data/test/tc_xml_node4.rb +86 -86
- data/test/tc_xml_node5.rb +52 -52
- data/test/tc_xml_node6.rb +27 -27
- data/test/tc_xml_node7.rb +35 -35
- data/test/tc_xml_node8.rb +32 -32
- data/test/tc_xml_node9.rb +32 -32
- data/test/tc_xml_node_set.rb +24 -24
- data/test/tc_xml_node_set2.rb +37 -37
- data/test/tc_xml_node_xlink.rb +28 -28
- data/test/tc_xml_parser.rb +190 -178
- data/test/tc_xml_parser2.rb +16 -17
- data/test/tc_xml_parser3.rb +23 -23
- data/test/tc_xml_parser4.rb +33 -33
- data/test/tc_xml_parser5.rb +27 -27
- data/test/tc_xml_parser6.rb +23 -23
- data/test/tc_xml_parser7.rb +28 -28
- data/test/tc_xml_parser8.rb +32 -32
- data/test/tc_xml_parser9.rb +11 -0
- data/test/tc_xml_parser_context.rb +88 -88
- data/test/tc_xml_reader.rb +112 -109
- data/test/tc_xml_sax_parser.rb +104 -94
- data/test/tc_xml_sax_parser2.rb +51 -0
- data/test/tc_xml_xinclude.rb +30 -30
- data/test/tc_xml_xpath.rb +38 -38
- data/test/tc_xml_xpath2.rb +14 -0
- data/test/tc_xml_xpointer.rb +78 -78
- data/vc/libxml.sln +20 -0
- data/vc/libxml.vcproj +389 -0
- data/work/Rakefile +247 -0
- data/work/task/make +26 -0
- data/work/task/memory +37 -0
- data/work/task/rdoc +39 -0
- data/work/task/setup +1616 -0
- data/work/task/test +29 -0
- data/work/test/ets_runner.rb +33 -0
- data/work/test/libxml_test.rb +3 -0
- data/work/test/runner.rb +0 -0
- data/work/test/runner_ets.rb +33 -0
- data/work/vc/debug/libxml.exp +0 -0
- data/work/vc/debug/libxml.ilk +0 -0
- data/work/vc/debug/libxml.lib +0 -0
- data/work/vc/debug/libxml.pdb +0 -0
- data/work/vc/debug/libxml.so +0 -0
- metadata +158 -189
- data/MANIFEST +0 -138
- data/NOTES +0 -9
- data/Rakefile +0 -38
- data/TODO +0 -75
- data/VERSION +0 -1
- data/log/Changelog-0.txt +0 -426
- data/log/Changelog.txt +0 -435
- data/meta/project.yaml +0 -27
- data/meta/unixname +0 -1
- data/setup.rb +0 -1472
- data/site/css/normal.css +0 -182
- data/site/img/raze-tiny.png +0 -0
- data/site/img/red-cube.jpg +0 -0
- data/site/img/xml-ruby.png +0 -0
- data/site/index.xml +0 -43
- data/site/install.xml +0 -77
- data/site/layout.rhtml +0 -38
- data/site/layout.xsl +0 -67
- data/site/license.xml +0 -32
- data/site/log/changelog.xml +0 -1324
- data/site/log/changelog.xsl +0 -42
- data/test/model/merge_bug_data.xml +0 -58
- data/test/model/rubynet.xml +0 -78
- data/test/model/rubynet_project +0 -13
- data/test/model/saxtest.xml +0 -5
- data/test/model/simple.xml +0 -7
- data/test/model/xinclude.xml +0 -5
data/LICENSE
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
LibXML-Ruby
|
2
|
-
|
3
|
-
Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
|
4
|
-
Copyright (c) 2001 Wai-Sun "Squidster" Chia <waisun.chia@compaq.com>
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
-
this software and associated documentation files (the "Software"), to deal in
|
8
|
-
the Software without restriction, including without limitation the rights to
|
9
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
10
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
11
|
-
so, subject to the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
14
|
-
copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
SOFTWARE.
|
23
|
-
|
1
|
+
LibXML-Ruby
|
2
|
+
|
3
|
+
Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
|
4
|
+
Copyright (c) 2001 Wai-Sun "Squidster" Chia <waisun.chia@compaq.com>
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
+
this software and associated documentation files (the "Software"), to deal in
|
8
|
+
the Software without restriction, including without limitation the rights to
|
9
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
10
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
11
|
+
so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
23
|
+
|
data/README
CHANGED
@@ -1,144 +1,144 @@
|
|
1
|
-
== INSTALLATION
|
2
|
-
|
3
|
-
Installation is simple. Follow the following steps:
|
4
|
-
|
5
|
-
=== Rubygems
|
6
|
-
|
7
|
-
gem install libxml-ruby
|
8
|
-
|
9
|
-
=== Tarball/zip
|
10
|
-
|
11
|
-
$ rake test
|
12
|
-
$ rake install
|
13
|
-
|
14
|
-
If extconf yacks up an error, follow the instructions it provides.
|
15
|
-
You will need to chdir to ext/xml and run 'ruby extconf.rb' to provide
|
16
|
-
options, after which you can either use Rake for everything or
|
17
|
-
do with make (make && make install).
|
18
|
-
|
19
|
-
Once installed, look at the test scripts (tests/*.rb), and run
|
20
|
-
'rake doc' to generate API documentation.
|
21
|
-
You can find the latest documentation at:
|
22
|
-
|
23
|
-
* http://libxml.rubyforge.org/doc
|
24
|
-
|
25
|
-
== DEPENDENCIES
|
26
|
-
|
27
|
-
libxml requires a few other libraries to be installed inorder to
|
28
|
-
function properly.
|
29
|
-
|
30
|
-
* libm (math routines: very standard)
|
31
|
-
* libz (zlib)
|
32
|
-
* libiconv
|
33
|
-
* libxml2
|
34
|
-
|
35
|
-
== USAGE
|
36
|
-
|
37
|
-
Basic usage for reading and writing documents.
|
38
|
-
|
39
|
-
=== WRITING
|
40
|
-
|
41
|
-
Writing a simple document:
|
42
|
-
|
43
|
-
# require 'rubygems' # if installed via Gems
|
44
|
-
require 'xml/libxml'
|
45
|
-
|
46
|
-
doc = XML::Document.new()
|
47
|
-
doc.root = XML::Node.new('root_node')
|
48
|
-
root = doc.root
|
49
|
-
|
50
|
-
root << elem1 = XML::Node.new('elem1')
|
51
|
-
elem1['attr1'] = 'val1'
|
52
|
-
elem1['attr2'] = 'val2'
|
53
|
-
|
54
|
-
root << elem2 = XML::Node.new('elem2')
|
55
|
-
elem2['attr1'] = 'val1'
|
56
|
-
elem2['attr2'] = 'val2'
|
57
|
-
|
58
|
-
root << elem3 = XML::Node.new('elem3')
|
59
|
-
elem3 << elem4 = XML::Node.new('elem4')
|
60
|
-
elem3 << elem5 = XML::Node.new('elem5')
|
61
|
-
|
62
|
-
elem5 << elem6 = XML::Node.new('elem6')
|
63
|
-
elem6 << 'Content for element 6'
|
64
|
-
|
65
|
-
elem3['attr'] = 'baz'
|
66
|
-
|
67
|
-
# Namespace hack to reduce the numer of times XML:: is typed
|
68
|
-
include XML
|
69
|
-
root << elem7 = Node.new('foo')
|
70
|
-
1.upto(10) do |i|
|
71
|
-
elem7 << n = Node.new('bar')
|
72
|
-
n << i
|
73
|
-
end
|
74
|
-
|
75
|
-
format = true
|
76
|
-
doc.save('output.xml', format)
|
77
|
-
|
78
|
-
The file output.xml contains:
|
79
|
-
|
80
|
-
<?xml version="1.0"?>
|
81
|
-
<root_node>
|
82
|
-
<elem1 attr1="val1" attr2="val2"/>
|
83
|
-
<elem2 attr1="val1" attr2="val2"/>
|
84
|
-
<elem3 attr="baz">
|
85
|
-
<elem4/>
|
86
|
-
<elem5>
|
87
|
-
<elem6>Content for element 6</elem6>
|
88
|
-
</elem5>
|
89
|
-
</elem3>
|
90
|
-
<foo>
|
91
|
-
<bar>1</bar>
|
92
|
-
<bar>2</bar>
|
93
|
-
<bar>3</bar>
|
94
|
-
<bar>4</bar>
|
95
|
-
<bar>5</bar>
|
96
|
-
<bar>6</bar>
|
97
|
-
<bar>7</bar>
|
98
|
-
<bar>8</bar>
|
99
|
-
<bar>9</bar>
|
100
|
-
<bar>10</bar>
|
101
|
-
</foo>
|
102
|
-
</root_node>
|
103
|
-
|
104
|
-
=== READING
|
105
|
-
|
106
|
-
Reading XML is slightly more complex and there are many more ways to
|
107
|
-
perform this operation. This reads in and processes the above
|
108
|
-
generated XML document, output.xml. This script assumes that the
|
109
|
-
structure of the document is already known.
|
110
|
-
|
111
|
-
# require 'rubygems' # if installed via Gems
|
112
|
-
require 'xml/libxml'
|
113
|
-
doc = XML::Document.file('output.xml')
|
114
|
-
root = doc.root
|
115
|
-
|
116
|
-
puts "Root element name: #{root.name}"
|
117
|
-
|
118
|
-
elem3 = root.find('elem3').to_a.first
|
119
|
-
puts "Elem3: #{elem3['attr']}"
|
120
|
-
|
121
|
-
doc.find('//root_node/foo/bar').each do |node|
|
122
|
-
puts "Node path: #{node.path} \t Contents: #{node.content}"
|
123
|
-
end
|
124
|
-
|
125
|
-
And your terminal should look like:
|
126
|
-
|
127
|
-
Root element name: root_node
|
128
|
-
Elem3: baz
|
129
|
-
Node path: /root_node/foo/bar[1] Contents: 1
|
130
|
-
Node path: /root_node/foo/bar[2] Contents: 2
|
131
|
-
Node path: /root_node/foo/bar[3] Contents: 3
|
132
|
-
Node path: /root_node/foo/bar[4] Contents: 4
|
133
|
-
Node path: /root_node/foo/bar[5] Contents: 5
|
134
|
-
Node path: /root_node/foo/bar[6] Contents: 6
|
135
|
-
Node path: /root_node/foo/bar[7] Contents: 7
|
136
|
-
Node path: /root_node/foo/bar[8] Contents: 8
|
137
|
-
Node path: /root_node/foo/bar[9] Contents: 9
|
138
|
-
Node path: /root_node/foo/bar[10] Contents: 10
|
139
|
-
|
140
|
-
== MORE INFORMATION
|
141
|
-
|
142
|
-
If you have any questions, please send email to libxml-devel@rubyforge.org.
|
143
|
-
|
144
|
-
# $Id: README 143 2007-08-29 21:45:48Z transami $
|
1
|
+
== INSTALLATION
|
2
|
+
|
3
|
+
Installation is simple. Follow the following steps:
|
4
|
+
|
5
|
+
=== Rubygems
|
6
|
+
|
7
|
+
gem install libxml-ruby
|
8
|
+
|
9
|
+
=== Tarball/zip
|
10
|
+
|
11
|
+
$ rake test
|
12
|
+
$ rake install
|
13
|
+
|
14
|
+
If extconf yacks up an error, follow the instructions it provides.
|
15
|
+
You will need to chdir to ext/xml and run 'ruby extconf.rb' to provide
|
16
|
+
options, after which you can either use Rake for everything or
|
17
|
+
do with make (make && make install).
|
18
|
+
|
19
|
+
Once installed, look at the test scripts (tests/*.rb), and run
|
20
|
+
'rake doc' to generate API documentation.
|
21
|
+
You can find the latest documentation at:
|
22
|
+
|
23
|
+
* http://libxml.rubyforge.org/doc
|
24
|
+
|
25
|
+
== DEPENDENCIES
|
26
|
+
|
27
|
+
libxml requires a few other libraries to be installed inorder to
|
28
|
+
function properly.
|
29
|
+
|
30
|
+
* libm (math routines: very standard)
|
31
|
+
* libz (zlib)
|
32
|
+
* libiconv
|
33
|
+
* libxml2
|
34
|
+
|
35
|
+
== USAGE
|
36
|
+
|
37
|
+
Basic usage for reading and writing documents.
|
38
|
+
|
39
|
+
=== WRITING
|
40
|
+
|
41
|
+
Writing a simple document:
|
42
|
+
|
43
|
+
# require 'rubygems' # if installed via Gems
|
44
|
+
require 'xml/libxml'
|
45
|
+
|
46
|
+
doc = XML::Document.new()
|
47
|
+
doc.root = XML::Node.new('root_node')
|
48
|
+
root = doc.root
|
49
|
+
|
50
|
+
root << elem1 = XML::Node.new('elem1')
|
51
|
+
elem1['attr1'] = 'val1'
|
52
|
+
elem1['attr2'] = 'val2'
|
53
|
+
|
54
|
+
root << elem2 = XML::Node.new('elem2')
|
55
|
+
elem2['attr1'] = 'val1'
|
56
|
+
elem2['attr2'] = 'val2'
|
57
|
+
|
58
|
+
root << elem3 = XML::Node.new('elem3')
|
59
|
+
elem3 << elem4 = XML::Node.new('elem4')
|
60
|
+
elem3 << elem5 = XML::Node.new('elem5')
|
61
|
+
|
62
|
+
elem5 << elem6 = XML::Node.new('elem6')
|
63
|
+
elem6 << 'Content for element 6'
|
64
|
+
|
65
|
+
elem3['attr'] = 'baz'
|
66
|
+
|
67
|
+
# Namespace hack to reduce the numer of times XML:: is typed
|
68
|
+
include XML
|
69
|
+
root << elem7 = Node.new('foo')
|
70
|
+
1.upto(10) do |i|
|
71
|
+
elem7 << n = Node.new('bar')
|
72
|
+
n << i
|
73
|
+
end
|
74
|
+
|
75
|
+
format = true
|
76
|
+
doc.save('output.xml', format)
|
77
|
+
|
78
|
+
The file output.xml contains:
|
79
|
+
|
80
|
+
<?xml version="1.0"?>
|
81
|
+
<root_node>
|
82
|
+
<elem1 attr1="val1" attr2="val2"/>
|
83
|
+
<elem2 attr1="val1" attr2="val2"/>
|
84
|
+
<elem3 attr="baz">
|
85
|
+
<elem4/>
|
86
|
+
<elem5>
|
87
|
+
<elem6>Content for element 6</elem6>
|
88
|
+
</elem5>
|
89
|
+
</elem3>
|
90
|
+
<foo>
|
91
|
+
<bar>1</bar>
|
92
|
+
<bar>2</bar>
|
93
|
+
<bar>3</bar>
|
94
|
+
<bar>4</bar>
|
95
|
+
<bar>5</bar>
|
96
|
+
<bar>6</bar>
|
97
|
+
<bar>7</bar>
|
98
|
+
<bar>8</bar>
|
99
|
+
<bar>9</bar>
|
100
|
+
<bar>10</bar>
|
101
|
+
</foo>
|
102
|
+
</root_node>
|
103
|
+
|
104
|
+
=== READING
|
105
|
+
|
106
|
+
Reading XML is slightly more complex and there are many more ways to
|
107
|
+
perform this operation. This reads in and processes the above
|
108
|
+
generated XML document, output.xml. This script assumes that the
|
109
|
+
structure of the document is already known.
|
110
|
+
|
111
|
+
# require 'rubygems' # if installed via Gems
|
112
|
+
require 'xml/libxml'
|
113
|
+
doc = XML::Document.file('output.xml')
|
114
|
+
root = doc.root
|
115
|
+
|
116
|
+
puts "Root element name: #{root.name}"
|
117
|
+
|
118
|
+
elem3 = root.find('elem3').to_a.first
|
119
|
+
puts "Elem3: #{elem3['attr']}"
|
120
|
+
|
121
|
+
doc.find('//root_node/foo/bar').each do |node|
|
122
|
+
puts "Node path: #{node.path} \t Contents: #{node.content}"
|
123
|
+
end
|
124
|
+
|
125
|
+
And your terminal should look like:
|
126
|
+
|
127
|
+
Root element name: root_node
|
128
|
+
Elem3: baz
|
129
|
+
Node path: /root_node/foo/bar[1] Contents: 1
|
130
|
+
Node path: /root_node/foo/bar[2] Contents: 2
|
131
|
+
Node path: /root_node/foo/bar[3] Contents: 3
|
132
|
+
Node path: /root_node/foo/bar[4] Contents: 4
|
133
|
+
Node path: /root_node/foo/bar[5] Contents: 5
|
134
|
+
Node path: /root_node/foo/bar[6] Contents: 6
|
135
|
+
Node path: /root_node/foo/bar[7] Contents: 7
|
136
|
+
Node path: /root_node/foo/bar[8] Contents: 8
|
137
|
+
Node path: /root_node/foo/bar[9] Contents: 9
|
138
|
+
Node path: /root_node/foo/bar[10] Contents: 10
|
139
|
+
|
140
|
+
== MORE INFORMATION
|
141
|
+
|
142
|
+
If you have any questions, please send email to libxml-devel@rubyforge.org.
|
143
|
+
|
144
|
+
# $Id: README 143 2007-08-29 21:45:48Z transami $
|
data/ext/libxml/extconf.rb
CHANGED
@@ -6,6 +6,7 @@ def method_missing(s, *args)
|
|
6
6
|
if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
|
7
7
|
return v
|
8
8
|
else
|
9
|
+
puts "missing: #{s}"
|
9
10
|
super
|
10
11
|
end
|
11
12
|
end
|
@@ -18,7 +19,7 @@ if RUBY_PLATFORM =~ /win32/ # FIXME: Make more robust
|
|
18
19
|
# built with VC++ while here we want to build
|
19
20
|
# with MingW. So just roll our own...
|
20
21
|
|
21
|
-
target = "
|
22
|
+
target = "libxml"
|
22
23
|
|
23
24
|
#RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
24
25
|
#RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
@@ -31,12 +32,12 @@ if RUBY_PLATFORM =~ /win32/ # FIXME: Make more robust
|
|
31
32
|
|
32
33
|
srcs = Dir['../ext/*.c']
|
33
34
|
|
34
|
-
objs =
|
35
|
+
objs = srcs.collect do |srcfile|
|
35
36
|
srcfile = File.basename(srcfile)
|
36
37
|
srcfile.chomp(File.extname(srcfile) + '.o')
|
37
38
|
end
|
38
39
|
|
39
|
-
#
|
40
|
+
#srcs.each do |srcfile|
|
40
41
|
# srcfile = File.basename(srcfile)
|
41
42
|
# objfile = srcfile.chomp(File.extname(srcfile) + '.o')
|
42
43
|
#
|
@@ -109,11 +110,11 @@ else
|
|
109
110
|
need libiconv.
|
110
111
|
|
111
112
|
Install the libiconv or try passing one of the following options
|
112
|
-
|
113
|
+
to extconf.rb:
|
113
114
|
|
114
|
-
|
115
|
-
|
116
|
-
|
115
|
+
--with-iconv-dir=/path/to/iconv
|
116
|
+
--with-iconv-lib=/path/to/iconv/lib
|
117
|
+
--with-iconv-include=/path/to/iconv/include
|
117
118
|
EOL
|
118
119
|
end
|
119
120
|
|
@@ -122,7 +123,7 @@ EOL
|
|
122
123
|
find_library('xml2', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
123
124
|
(have_header('libxml/xmlversion.h') or
|
124
125
|
find_header('libxml/xmlversion.h',
|
125
|
-
|
126
|
+
"#{CONFIG['prefix']}/include",
|
126
127
|
'/opt/include/libxml2',
|
127
128
|
'/usr/local/include/libxml2',
|
128
129
|
'/usr/include/libxml2'))
|
@@ -149,9 +150,7 @@ EOL
|
|
149
150
|
#$INSTALLFILES = [["libxml.rb", "$(RUBYLIBDIR)", "../xml"]]
|
150
151
|
|
151
152
|
create_header()
|
152
|
-
|
153
|
-
create_makefile('libxml_so')
|
154
|
-
|
153
|
+
create_makefile('libxml_ruby')
|
155
154
|
end
|
156
155
|
|
157
156
|
__END__
|
@@ -255,29 +254,29 @@ TARGET_SO = $(DLLIB)
|
|
255
254
|
CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
|
256
255
|
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
257
256
|
|
258
|
-
all:
|
259
|
-
static:
|
257
|
+
all: $(DLLIB)
|
258
|
+
static: $(STATIC_LIB)
|
260
259
|
|
261
260
|
clean:
|
262
|
-
|
261
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
263
262
|
|
264
|
-
distclean:
|
265
|
-
|
266
|
-
|
263
|
+
distclean: clean
|
264
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
265
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
267
266
|
|
268
|
-
realclean:
|
267
|
+
realclean: distclean
|
269
268
|
install: install-so install-rb
|
270
269
|
|
271
270
|
install-so: $(RUBYARCHDIR)
|
272
271
|
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
273
272
|
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
274
|
-
|
273
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
275
274
|
install-rb: pre-install-rb install-rb-default
|
276
275
|
install-rb-default: pre-install-rb-default
|
277
276
|
pre-install-rb: Makefile
|
278
277
|
pre-install-rb-default: Makefile
|
279
278
|
$(RUBYARCHDIR):
|
280
|
-
|
279
|
+
$(MAKEDIRS) $@
|
281
280
|
|
282
281
|
site-install: site-install-so site-install-rb
|
283
282
|
site-install-so: install-so
|
@@ -286,23 +285,23 @@ site-install-rb: install-rb
|
|
286
285
|
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
287
286
|
|
288
287
|
.cc.o:
|
289
|
-
|
288
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
290
289
|
|
291
290
|
.cxx.o:
|
292
|
-
|
291
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
293
292
|
|
294
293
|
.cpp.o:
|
295
|
-
|
294
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
296
295
|
|
297
296
|
.C.o:
|
298
|
-
|
297
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
299
298
|
|
300
299
|
.c.o:
|
301
|
-
|
300
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
302
301
|
|
303
302
|
$(DLLIB): $(OBJS)
|
304
|
-
|
305
|
-
|
303
|
+
@-$(RM) $@
|
304
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
306
305
|
|
307
306
|
|
308
307
|
$(OBJS): ruby.h defines.h $(RUBY_EXTCONF_H)
|
data/ext/libxml/libxml.c
CHANGED
@@ -1,42 +1,8 @@
|
|
1
|
-
/* $Id: libxml.c
|
1
|
+
/* $Id: libxml.c 300 2008-07-01 19:14:15Z cfis $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
5
|
-
#include "
|
6
|
-
|
7
|
-
/* Ruby's util.h has ruby_strdup */
|
8
|
-
#include "util.h"
|
9
|
-
|
10
|
-
#ifdef xmlMalloc
|
11
|
-
#undef xmlMalloc
|
12
|
-
#endif
|
13
|
-
#ifdef xmlRealloc
|
14
|
-
#undef xmlRealloc
|
15
|
-
#endif
|
16
|
-
#ifdef xmlMemStrdup
|
17
|
-
#undef xmlMemStrdup
|
18
|
-
#endif
|
19
|
-
#ifdef xmlMemFree
|
20
|
-
#undef xmlMemFree
|
21
|
-
#endif
|
22
|
-
|
23
|
-
#ifdef RubyMemMalloc
|
24
|
-
#undef RubyMemMalloc
|
25
|
-
#endif
|
26
|
-
#ifdef RubyMemRealloc
|
27
|
-
#undef RubyMemRealloc
|
28
|
-
#endif
|
29
|
-
#ifdef RubyMemStrdup
|
30
|
-
#undef RubyMemStrdup
|
31
|
-
#endif
|
32
|
-
#ifdef RubyMemFree
|
33
|
-
#undef RubyMemFree
|
34
|
-
#endif
|
35
|
-
|
36
|
-
#define RubyMemFree ruby_xfree
|
37
|
-
#define RubyMemRealloc ruby_xrealloc
|
38
|
-
#define RubyMemMalloc ruby_xmalloc
|
39
|
-
#define RubyMemStrdup ruby_strdup
|
5
|
+
#include "ruby_libxml.h"
|
40
6
|
|
41
7
|
VALUE mXML;
|
42
8
|
VALUE eXMLError;
|
@@ -46,8 +12,12 @@ static xmlMallocFunc mallocFunc = NULL;
|
|
46
12
|
static xmlReallocFunc reallocFunc = NULL;
|
47
13
|
static xmlStrdupFunc strdupFunc = NULL;
|
48
14
|
|
15
|
+
#if defined(_WIN32)
|
16
|
+
__declspec(dllexport)
|
17
|
+
#endif
|
18
|
+
|
49
19
|
void
|
50
|
-
|
20
|
+
Init_libxml_ruby(void) {
|
51
21
|
/* Some libxml memory goo that should be done before anything else */
|
52
22
|
#ifdef NONE
|
53
23
|
xmlMemGet((xmlFreeFunc *) & freeFunc,
|