libxml-ruby 3.2.2-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/HISTORY +848 -0
  3. data/LICENSE +21 -0
  4. data/MANIFEST +166 -0
  5. data/README.rdoc +217 -0
  6. data/Rakefile +99 -0
  7. data/ext/libxml/extconf.rb +61 -0
  8. data/ext/libxml/libxml.c +80 -0
  9. data/ext/libxml/libxml_ruby.def +35 -0
  10. data/ext/libxml/ruby_libxml.h +67 -0
  11. data/ext/libxml/ruby_xml.c +933 -0
  12. data/ext/libxml/ruby_xml.h +10 -0
  13. data/ext/libxml/ruby_xml_attr.c +333 -0
  14. data/ext/libxml/ruby_xml_attr.h +12 -0
  15. data/ext/libxml/ruby_xml_attr_decl.c +153 -0
  16. data/ext/libxml/ruby_xml_attr_decl.h +11 -0
  17. data/ext/libxml/ruby_xml_attributes.c +275 -0
  18. data/ext/libxml/ruby_xml_attributes.h +15 -0
  19. data/ext/libxml/ruby_xml_cbg.c +85 -0
  20. data/ext/libxml/ruby_xml_document.c +1123 -0
  21. data/ext/libxml/ruby_xml_document.h +11 -0
  22. data/ext/libxml/ruby_xml_dtd.c +248 -0
  23. data/ext/libxml/ruby_xml_dtd.h +9 -0
  24. data/ext/libxml/ruby_xml_encoding.c +250 -0
  25. data/ext/libxml/ruby_xml_encoding.h +16 -0
  26. data/ext/libxml/ruby_xml_error.c +996 -0
  27. data/ext/libxml/ruby_xml_error.h +12 -0
  28. data/ext/libxml/ruby_xml_html_parser.c +89 -0
  29. data/ext/libxml/ruby_xml_html_parser.h +10 -0
  30. data/ext/libxml/ruby_xml_html_parser_context.c +337 -0
  31. data/ext/libxml/ruby_xml_html_parser_context.h +10 -0
  32. data/ext/libxml/ruby_xml_html_parser_options.c +46 -0
  33. data/ext/libxml/ruby_xml_html_parser_options.h +10 -0
  34. data/ext/libxml/ruby_xml_input_cbg.c +191 -0
  35. data/ext/libxml/ruby_xml_input_cbg.h +20 -0
  36. data/ext/libxml/ruby_xml_io.c +47 -0
  37. data/ext/libxml/ruby_xml_io.h +10 -0
  38. data/ext/libxml/ruby_xml_namespace.c +153 -0
  39. data/ext/libxml/ruby_xml_namespace.h +10 -0
  40. data/ext/libxml/ruby_xml_namespaces.c +293 -0
  41. data/ext/libxml/ruby_xml_namespaces.h +9 -0
  42. data/ext/libxml/ruby_xml_node.c +1402 -0
  43. data/ext/libxml/ruby_xml_node.h +13 -0
  44. data/ext/libxml/ruby_xml_parser.c +91 -0
  45. data/ext/libxml/ruby_xml_parser.h +12 -0
  46. data/ext/libxml/ruby_xml_parser_context.c +999 -0
  47. data/ext/libxml/ruby_xml_parser_context.h +10 -0
  48. data/ext/libxml/ruby_xml_parser_options.c +66 -0
  49. data/ext/libxml/ruby_xml_parser_options.h +12 -0
  50. data/ext/libxml/ruby_xml_reader.c +1239 -0
  51. data/ext/libxml/ruby_xml_reader.h +17 -0
  52. data/ext/libxml/ruby_xml_relaxng.c +110 -0
  53. data/ext/libxml/ruby_xml_relaxng.h +10 -0
  54. data/ext/libxml/ruby_xml_sax2_handler.c +326 -0
  55. data/ext/libxml/ruby_xml_sax2_handler.h +10 -0
  56. data/ext/libxml/ruby_xml_sax_parser.c +116 -0
  57. data/ext/libxml/ruby_xml_sax_parser.h +10 -0
  58. data/ext/libxml/ruby_xml_schema.c +278 -0
  59. data/ext/libxml/ruby_xml_schema.h +809 -0
  60. data/ext/libxml/ruby_xml_schema_attribute.c +109 -0
  61. data/ext/libxml/ruby_xml_schema_attribute.h +15 -0
  62. data/ext/libxml/ruby_xml_schema_element.c +95 -0
  63. data/ext/libxml/ruby_xml_schema_element.h +14 -0
  64. data/ext/libxml/ruby_xml_schema_facet.c +52 -0
  65. data/ext/libxml/ruby_xml_schema_facet.h +13 -0
  66. data/ext/libxml/ruby_xml_schema_type.c +232 -0
  67. data/ext/libxml/ruby_xml_schema_type.h +9 -0
  68. data/ext/libxml/ruby_xml_version.h +9 -0
  69. data/ext/libxml/ruby_xml_writer.c +1133 -0
  70. data/ext/libxml/ruby_xml_writer.h +10 -0
  71. data/ext/libxml/ruby_xml_xinclude.c +16 -0
  72. data/ext/libxml/ruby_xml_xinclude.h +11 -0
  73. data/ext/libxml/ruby_xml_xpath.c +194 -0
  74. data/ext/libxml/ruby_xml_xpath.h +13 -0
  75. data/ext/libxml/ruby_xml_xpath_context.c +360 -0
  76. data/ext/libxml/ruby_xml_xpath_context.h +9 -0
  77. data/ext/libxml/ruby_xml_xpath_expression.c +81 -0
  78. data/ext/libxml/ruby_xml_xpath_expression.h +10 -0
  79. data/ext/libxml/ruby_xml_xpath_object.c +338 -0
  80. data/ext/libxml/ruby_xml_xpath_object.h +17 -0
  81. data/ext/libxml/ruby_xml_xpointer.c +99 -0
  82. data/ext/libxml/ruby_xml_xpointer.h +11 -0
  83. data/ext/vc/libxml_ruby.sln +28 -0
  84. data/lib/3.1/libxml_ruby.so +0 -0
  85. data/lib/libxml/attr.rb +123 -0
  86. data/lib/libxml/attr_decl.rb +80 -0
  87. data/lib/libxml/attributes.rb +14 -0
  88. data/lib/libxml/document.rb +194 -0
  89. data/lib/libxml/error.rb +95 -0
  90. data/lib/libxml/hpricot.rb +78 -0
  91. data/lib/libxml/html_parser.rb +96 -0
  92. data/lib/libxml/namespace.rb +62 -0
  93. data/lib/libxml/namespaces.rb +38 -0
  94. data/lib/libxml/node.rb +323 -0
  95. data/lib/libxml/parser.rb +101 -0
  96. data/lib/libxml/sax_callbacks.rb +180 -0
  97. data/lib/libxml/sax_parser.rb +41 -0
  98. data/lib/libxml/schema/attribute.rb +19 -0
  99. data/lib/libxml/schema/element.rb +19 -0
  100. data/lib/libxml/schema/type.rb +21 -0
  101. data/lib/libxml/schema.rb +48 -0
  102. data/lib/libxml/tree.rb +29 -0
  103. data/lib/libxml-ruby.rb +30 -0
  104. data/lib/libxml.rb +5 -0
  105. data/lib/xml/libxml.rb +10 -0
  106. data/lib/xml.rb +14 -0
  107. data/libxml-ruby.gemspec +48 -0
  108. data/script/benchmark/depixelate +634 -0
  109. data/script/benchmark/hamlet.xml +9055 -0
  110. data/script/benchmark/parsecount +170 -0
  111. data/script/benchmark/sock_entries.xml +507 -0
  112. data/script/benchmark/throughput +41 -0
  113. data/script/test +6 -0
  114. data/setup.rb +1584 -0
  115. data/test/c14n/given/doc.dtd +1 -0
  116. data/test/c14n/given/example-1.xml +14 -0
  117. data/test/c14n/given/example-2.xml +11 -0
  118. data/test/c14n/given/example-3.xml +18 -0
  119. data/test/c14n/given/example-4.xml +9 -0
  120. data/test/c14n/given/example-5.xml +12 -0
  121. data/test/c14n/given/example-6.xml +2 -0
  122. data/test/c14n/given/example-7.xml +11 -0
  123. data/test/c14n/given/example-8.xml +11 -0
  124. data/test/c14n/given/example-8.xpath +10 -0
  125. data/test/c14n/given/world.txt +1 -0
  126. data/test/c14n/result/1-1-without-comments/example-1 +4 -0
  127. data/test/c14n/result/1-1-without-comments/example-2 +11 -0
  128. data/test/c14n/result/1-1-without-comments/example-3 +14 -0
  129. data/test/c14n/result/1-1-without-comments/example-4 +9 -0
  130. data/test/c14n/result/1-1-without-comments/example-5 +3 -0
  131. data/test/c14n/result/1-1-without-comments/example-6 +1 -0
  132. data/test/c14n/result/1-1-without-comments/example-7 +1 -0
  133. data/test/c14n/result/1-1-without-comments/example-8 +1 -0
  134. data/test/c14n/result/with-comments/example-1 +6 -0
  135. data/test/c14n/result/with-comments/example-2 +11 -0
  136. data/test/c14n/result/with-comments/example-3 +14 -0
  137. data/test/c14n/result/with-comments/example-4 +9 -0
  138. data/test/c14n/result/with-comments/example-5 +4 -0
  139. data/test/c14n/result/with-comments/example-6 +1 -0
  140. data/test/c14n/result/with-comments/example-7 +1 -0
  141. data/test/c14n/result/without-comments/example-1 +4 -0
  142. data/test/c14n/result/without-comments/example-2 +11 -0
  143. data/test/c14n/result/without-comments/example-3 +14 -0
  144. data/test/c14n/result/without-comments/example-4 +9 -0
  145. data/test/c14n/result/without-comments/example-5 +3 -0
  146. data/test/c14n/result/without-comments/example-6 +1 -0
  147. data/test/c14n/result/without-comments/example-7 +1 -0
  148. data/test/model/atom.xml +13 -0
  149. data/test/model/bands.iso-8859-1.xml +5 -0
  150. data/test/model/bands.utf-8.xml +5 -0
  151. data/test/model/bands.xml +5 -0
  152. data/test/model/books.xml +154 -0
  153. data/test/model/cwm_1_0.xml +11336 -0
  154. data/test/model/merge_bug_data.xml +58 -0
  155. data/test/model/ruby-lang.html +238 -0
  156. data/test/model/rubynet.xml +79 -0
  157. data/test/model/rubynet_project +1 -0
  158. data/test/model/shiporder.rnc +28 -0
  159. data/test/model/shiporder.rng +86 -0
  160. data/test/model/shiporder.xml +23 -0
  161. data/test/model/shiporder.xsd +40 -0
  162. data/test/model/soap.xml +27 -0
  163. data/test/model/xinclude.xml +5 -0
  164. data/test/test_attr.rb +181 -0
  165. data/test/test_attr_decl.rb +132 -0
  166. data/test/test_attributes.rb +136 -0
  167. data/test/test_canonicalize.rb +120 -0
  168. data/test/test_deprecated_require.rb +12 -0
  169. data/test/test_document.rb +132 -0
  170. data/test/test_document_write.rb +146 -0
  171. data/test/test_dtd.rb +129 -0
  172. data/test/test_encoding.rb +129 -0
  173. data/test/test_encoding_sax.rb +115 -0
  174. data/test/test_error.rb +178 -0
  175. data/test/test_helper.rb +9 -0
  176. data/test/test_html_parser.rb +162 -0
  177. data/test/test_html_parser_context.rb +23 -0
  178. data/test/test_namespace.rb +60 -0
  179. data/test/test_namespaces.rb +200 -0
  180. data/test/test_node.rb +237 -0
  181. data/test/test_node_cdata.rb +50 -0
  182. data/test/test_node_comment.rb +32 -0
  183. data/test/test_node_copy.rb +40 -0
  184. data/test/test_node_edit.rb +158 -0
  185. data/test/test_node_pi.rb +37 -0
  186. data/test/test_node_text.rb +69 -0
  187. data/test/test_node_write.rb +97 -0
  188. data/test/test_node_xlink.rb +28 -0
  189. data/test/test_parser.rb +324 -0
  190. data/test/test_parser_context.rb +198 -0
  191. data/test/test_properties.rb +38 -0
  192. data/test/test_reader.rb +364 -0
  193. data/test/test_relaxng.rb +53 -0
  194. data/test/test_sax_parser.rb +326 -0
  195. data/test/test_schema.rb +168 -0
  196. data/test/test_suite.rb +48 -0
  197. data/test/test_traversal.rb +152 -0
  198. data/test/test_writer.rb +468 -0
  199. data/test/test_xinclude.rb +20 -0
  200. data/test/test_xml.rb +263 -0
  201. data/test/test_xpath.rb +244 -0
  202. data/test/test_xpath_context.rb +88 -0
  203. data/test/test_xpath_expression.rb +37 -0
  204. data/test/test_xpointer.rb +72 -0
  205. metadata +325 -0
data/LICENSE ADDED
@@ -0,0 +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
21
+ SOFTWARE.
data/MANIFEST ADDED
@@ -0,0 +1,166 @@
1
+ #!mast -x doc/libxml-ruby/rdoc -i .gitignore ext doc lib script test [A-Z]*
2
+ ext/libxml/extconf.rb
3
+ ext/libxml/libxml.c
4
+ ext/libxml/ruby_libxml.h
5
+ ext/libxml/ruby_xml.c
6
+ ext/libxml/ruby_xml.h
7
+ ext/libxml/ruby_xml_attr.c
8
+ ext/libxml/ruby_xml_attr.h
9
+ ext/libxml/ruby_xml_attr_decl.c
10
+ ext/libxml/ruby_xml_attr_decl.h
11
+ ext/libxml/ruby_xml_attributes.c
12
+ ext/libxml/ruby_xml_attributes.h
13
+ ext/libxml/ruby_xml_cbg.c
14
+ ext/libxml/ruby_xml_document.c
15
+ ext/libxml/ruby_xml_document.h
16
+ ext/libxml/ruby_xml_dtd.c
17
+ ext/libxml/ruby_xml_dtd.h
18
+ ext/libxml/ruby_xml_encoding.c
19
+ ext/libxml/ruby_xml_encoding.h
20
+ ext/libxml/ruby_xml_error.c
21
+ ext/libxml/ruby_xml_error.h
22
+ ext/libxml/ruby_xml_html_parser.c
23
+ ext/libxml/ruby_xml_html_parser.h
24
+ ext/libxml/ruby_xml_html_parser_context.c
25
+ ext/libxml/ruby_xml_html_parser_context.h
26
+ ext/libxml/ruby_xml_html_parser_options.c
27
+ ext/libxml/ruby_xml_html_parser_options.h
28
+ ext/libxml/ruby_xml_input_cbg.c
29
+ ext/libxml/ruby_xml_input_cbg.h
30
+ ext/libxml/ruby_xml_io.c
31
+ ext/libxml/ruby_xml_io.h
32
+ ext/libxml/ruby_xml_namespace.c
33
+ ext/libxml/ruby_xml_namespace.h
34
+ ext/libxml/ruby_xml_namespaces.c
35
+ ext/libxml/ruby_xml_namespaces.h
36
+ ext/libxml/ruby_xml_node.c
37
+ ext/libxml/ruby_xml_node.h
38
+ ext/libxml/ruby_xml_parser.c
39
+ ext/libxml/ruby_xml_parser.h
40
+ ext/libxml/ruby_xml_parser_context.c
41
+ ext/libxml/ruby_xml_parser_context.h
42
+ ext/libxml/ruby_xml_parser_options.c
43
+ ext/libxml/ruby_xml_parser_options.h
44
+ ext/libxml/ruby_xml_reader.c
45
+ ext/libxml/ruby_xml_reader.h
46
+ ext/libxml/ruby_xml_relaxng.c
47
+ ext/libxml/ruby_xml_relaxng.h
48
+ ext/libxml/ruby_xml_sax2_handler.c
49
+ ext/libxml/ruby_xml_sax2_handler.h
50
+ ext/libxml/ruby_xml_sax_parser.c
51
+ ext/libxml/ruby_xml_sax_parser.h
52
+ ext/libxml/ruby_xml_schema.c
53
+ ext/libxml/ruby_xml_schema.h
54
+ ext/libxml/ruby_xml_version.h
55
+ ext/libxml/ruby_xml_xinclude.c
56
+ ext/libxml/ruby_xml_xinclude.h
57
+ ext/libxml/ruby_xml_xpath.c
58
+ ext/libxml/ruby_xml_xpath.h
59
+ ext/libxml/ruby_xml_xpath_context.c
60
+ ext/libxml/ruby_xml_xpath_context.h
61
+ ext/libxml/ruby_xml_xpath_expression.c
62
+ ext/libxml/ruby_xml_xpath_expression.h
63
+ ext/libxml/ruby_xml_xpath_object.c
64
+ ext/libxml/ruby_xml_xpath_object.h
65
+ ext/libxml/ruby_xml_xpointer.c
66
+ ext/libxml/ruby_xml_xpointer.h
67
+ ext/mingw/Rakefile
68
+ ext/mingw/build.rake
69
+ ext/mingw/libiconv-2.dll
70
+ ext/mingw/libxml2-2.dll
71
+ ext/mingw/libxml_ruby.dll.a
72
+ ext/mingw/libxml_ruby.so
73
+ ext/vc/libxml_ruby.sln
74
+ ext/vc/libxml_ruby_18/libxml_ruby.vcproj
75
+ ext/vc/libxml_ruby_19/libxml_ruby_19.vcproj
76
+ doc/.htaccess
77
+ doc/.rsync-filter
78
+ lib/libxml/attr.rb
79
+ lib/libxml/attr_decl.rb
80
+ lib/libxml/attributes.rb
81
+ lib/libxml/document.rb
82
+ lib/libxml/error.rb
83
+ lib/libxml/hpricot.rb
84
+ lib/libxml/html_parser.rb
85
+ lib/libxml/namespace.rb
86
+ lib/libxml/namespaces.rb
87
+ lib/libxml/node.rb
88
+ lib/libxml/ns.rb
89
+ lib/libxml/parser.rb
90
+ lib/libxml/properties.rb
91
+ lib/libxml/reader.rb
92
+ lib/libxml/sax_callbacks.rb
93
+ lib/libxml/sax_parser.rb
94
+ lib/libxml/tree.rb
95
+ lib/libxml/xpath_object.rb
96
+ lib/libxml.rb
97
+ lib/xml/libxml.rb
98
+ lib/xml.rb
99
+ script/benchmark/depixelate
100
+ script/benchmark/hamlet.xml
101
+ script/benchmark/parsecount
102
+ script/benchmark/sock_entries.xml
103
+ script/benchmark/throughput
104
+ script/test
105
+ test/etc_doc_to_s.rb
106
+ test/ets_doc_file.rb
107
+ test/ets_doc_to_s.rb
108
+ test/ets_gpx.rb
109
+ test/ets_node_gc.rb
110
+ test/ets_test.xml
111
+ test/ets_tsr.rb
112
+ test/model/atom.xml
113
+ test/model/bands.xml
114
+ test/model/books.xml
115
+ test/model/merge_bug_data.xml
116
+ test/model/ruby-lang.html
117
+ test/model/rubynet.xml
118
+ test/model/rubynet_project
119
+ test/model/shiporder.rnc
120
+ test/model/shiporder.rng
121
+ test/model/shiporder.xml
122
+ test/model/shiporder.xsd
123
+ test/model/soap.xml
124
+ test/model/xinclude.xml
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
+ test/test_suite.rb
160
+ Rakefile
161
+ HISTORY.rdoc
162
+ PROFILE
163
+ TODO
164
+ LICENSE
165
+ README.rdoc
166
+ VERSION
data/README.rdoc ADDED
@@ -0,0 +1,217 @@
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
+ We think libxml-ruby is the best XML library for Ruby because:
8
+
9
+ * Speed - Its much faster than REXML and Hpricot
10
+ * Features - It provides an amazing number of featues
11
+ * Conformance - It passes all 1800+ tests from the OASIS XML Tests Suite
12
+
13
+ == Requirements
14
+ libxml-ruby requires Ruby 1.8.7 or higher. It depends on libxml2 to
15
+ function properly. libxml2, in turn, depends on:
16
+
17
+ * libm (math routines: very standard)
18
+ * libz (zlib)
19
+ * libiconv
20
+
21
+ If you are running Linux or Unix you'll need a C compiler so the
22
+ extension can be compiled when it is installed. If you are running
23
+ Windows, then install the x64-mingw32 gem or build it yourself using
24
+ Devkit[http://rubyinstaller.org/add-ons/devkit/] or
25
+ msys2[https://msys2.github.io/].
26
+
27
+ == Installation
28
+ The easiest way to install libxml-ruby is via RubyGems. To install:
29
+
30
+ <tt>gem install libxml-ruby</tt>
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
+
48
+ If you are running Windows, then install the libxml-ruby-x64-mingw32 gem.
49
+ The gem includes prebuilt extensions for Ruby 2.3. These
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>.
54
+
55
+ The gem also includes a Microsoft VC++ 2012 solution and XCode 5 project - these
56
+ are very useful for debugging.
57
+
58
+ libxml-ruby's source codes lives on GitHub[https://github.com/xml4r/libxml-ruby].
59
+
60
+ == Getting Started
61
+ Using libxml is easy. First decide what parser you want to use:
62
+
63
+ * Generally you'll want to use the LibXML::XML::Parser which provides a tree based API.
64
+ * For larger documents that don't fit into memory, or if you prefer an input based API, use the LibXML::XML::Reader.
65
+ * To parse HTML files use LibXML::XML::HTMLParser.
66
+ * If you are masochistic, then use the LibXML::XML::SaxParser, which provides a callback API.
67
+
68
+ Once you have chosen a parser, choose a datasource. Libxml can parse files, strings, URIs
69
+ and IO streams. For each data source you can specify an LibXML::XML::Encoding, a base uri and
70
+ various parser options. For more information, refer the LibXML::XML::Parser.document,
71
+ LibXML::XML::Parser.file, LibXML::XML::Parser.io or LibXML:::XML::Parser.string methods (the
72
+ same methods are defined on all four parser classes).
73
+
74
+ == Advanced Functionality
75
+ Beyond the basics of parsing and processing XML and HTML documents,
76
+ libxml provides a wealth of additional functionality.
77
+
78
+ Most commonly, you'll want to use its LibXML::XML::XPath support, which makes
79
+ it easy to find data inside an XML document. Although not as popular,
80
+ LibXML::XML::XPointer provides another API for finding data inside an XML document.
81
+
82
+ Often times you'll need to validate data before processing it. For example,
83
+ if you accept user generated content submitted over the Web, you'll
84
+ want to verify that it does not contain malicious code such as embedded scripts.
85
+ This can be done using libxml's powerful set of validators:
86
+
87
+ * DTDs (LibXML::XML::Dtd)
88
+ * Relax Schemas (LibXML::XML::RelaxNG)
89
+ * XML Schema (LibXML::XML::Schema)
90
+
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].
93
+
94
+ == Usage
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].
98
+
99
+ All libxml classes are in the LibXML::XML module. The easiest
100
+ way to use libxml is to <tt>require 'xml'</tt>. This will mixin
101
+ the LibXML module into the global namespace, allowing you to
102
+ write code like this:
103
+
104
+ require 'xml'
105
+ document = XML::Document.new
106
+
107
+ However, when creating an application or library you plan to
108
+ redistribute, it is best to not add the LibXML module to the global
109
+ namespace, in which case you can either write your code like this:
110
+
111
+ require 'libxml'
112
+ document = LibXML::XML::Document.new
113
+
114
+ Or you can utilize a namespace for your own work and include LibXML into it.
115
+ For example:
116
+
117
+ require 'libxml'
118
+
119
+ module MyApplication
120
+ include LibXML
121
+
122
+ class MyClass
123
+ def some_method
124
+ document = XML::Document.new
125
+ end
126
+ end
127
+ end
128
+
129
+ For simplicity's sake, the documentation uses the xml module in its examples.
130
+
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
+ == 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
+
148
+ == Performance
149
+
150
+ In addition to being feature rich and conformation, the main reason
151
+ people use libxml-ruby is for performance. Here are the results
152
+ of a couple simple benchmarks recently blogged about on the
153
+ Web (you can find them in the benchmark directory of the
154
+ libxml distribution).
155
+
156
+ From http://depixelate.com/2008/4/23/ruby-xml-parsing-benchmarks
157
+
158
+ user system total real
159
+ libxml 0.032000 0.000000 0.032000 ( 0.031000)
160
+ Hpricot 0.640000 0.031000 0.671000 ( 0.890000)
161
+ REXML 1.813000 0.047000 1.860000 ( 2.031000)
162
+
163
+ From https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks/
164
+
165
+ user system total real
166
+ libxml 0.641000 0.031000 0.672000 ( 0.672000)
167
+ hpricot 5.359000 0.062000 5.421000 ( 5.516000)
168
+ rexml 22.859000 0.047000 22.906000 ( 23.203000)
169
+
170
+
171
+ == Documentation
172
+ Documentation is available via rdoc, and is installed automatically with the
173
+ gem.
174
+
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.
178
+
179
+ Note that older versions of Rdoc, which ship with Ruby 1.8.x, will report
180
+ a number of errors. To avoid them, install Rdoc 2.1 or higher. Once you have
181
+ installed the gem, you'll have to disable the version of Rdoc that Ruby 1.8.x
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>.
185
+
186
+ == Support
187
+ If you have any questions about using libxml-ruby, please report an issue
188
+ on GitHub[https://github.com/xml4r/libxml-ruby/issues].
189
+
190
+ == Memory Management
191
+ libxml-ruby automatically manages memory associated with the
192
+ underlying libxml2 library. The bindings create a one-to-one mapping between
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,
195
+ the bindings manage the memory. They do this by installing a free
196
+ function and storing a back pointer to the Ruby object from the xmlnode
197
+ using the _private member on libxml structures. When the Ruby object
198
+ goes out of scope, the underlying libxml structure is freed. Libxml
199
+ itself then frees all child nodes (recursively).
200
+
201
+ For all other nodes (the vast majority), the bindings create temporary
202
+ Ruby objects that get freed once they go out of scope. Thus there can be
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,
206
+ then the methods return true. During the mark phase, each of these temporary
207
+ objects marks its owning document, thereby keeping the Ruby document object
208
+ alive and thus the xmldoc tree.
209
+
210
+ In the sweep phase of the garbage collector, or when a program ends,
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
214
+ and are no longer in scope (since if they were the document would not be freed).
215
+
216
+ == License
217
+ See LICENSE for license information.
data/Rakefile ADDED
@@ -0,0 +1,99 @@
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
+ 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
43
+ end
44
+
45
+ # Setup generic gem
46
+ Gem::PackageTask.new(spec) do |pkg|
47
+ pkg.package_dir = 'pkg'
48
+ pkg.need_tar = false
49
+ end
50
+
51
+ # Setup Windows Gem
52
+ if RUBY_PLATFORM.match(/mswin|mingw/)
53
+ binaries = (FileList['lib/**/*.so',
54
+ 'lib/**/*dll'])
55
+
56
+ # Windows specification
57
+ win_spec = spec.clone
58
+ win_spec.platform = Gem::Platform::CURRENT
59
+ win_spec.files += binaries.to_a
60
+ win_spec.instance_variable_set(:@cache_file, nil)
61
+
62
+ # Unset extensions
63
+ win_spec.extensions = nil
64
+
65
+ # Rake task to build the windows package
66
+ Gem::PackageTask.new(win_spec) do |pkg|
67
+ pkg.package_dir = 'pkg'
68
+ pkg.need_tar = false
69
+ end
70
+ end
71
+
72
+ # RDoc Task
73
+ desc 'Generate rdoc documentation'
74
+ RDoc::Task.new("rdoc") do |rdoc|
75
+ rdoc.rdoc_dir = 'rdoc'
76
+ rdoc.title = 'LibXML'
77
+ rdoc.generator = 'hanna'
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
99
+ end
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mkmf'
4
+
5
+ def crash(str)
6
+ printf(" extconf failure: %s\n", str)
7
+ exit 1
8
+ end
9
+
10
+ xc = with_config('xml2-config')
11
+ if xc
12
+ cflags = `#{xc} --cflags`.chomp
13
+ if $? != 0
14
+ cflags = nil
15
+ else
16
+ libs = `#{xc} --libs`.chomp
17
+ if $? != 0
18
+ libs = nil
19
+ else
20
+ $CFLAGS += ' ' + cflags
21
+ $libs = libs + " " + $libs
22
+ end
23
+ end
24
+ else
25
+ dir_config('xml2')
26
+ end
27
+
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
58
+ end
59
+
60
+ create_header()
61
+ create_makefile('libxml_ruby')
@@ -0,0 +1,80 @@
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
+ static void rxml_init_memory(void)
13
+ {
14
+ /* Disable for now - broke attributes.
15
+ xmlGcMemSetup(
16
+ (xmlFreeFunc)ruby_xfree,
17
+ (xmlMallocFunc)ruby_xmalloc,
18
+ (xmlMallocFunc)ruby_xmalloc,
19
+ (xmlReallocFunc)ruby_xrealloc,
20
+ (xmlStrdupFunc)ruby_strdup
21
+ );*/
22
+ }
23
+
24
+ void Init_libxml_ruby(void)
25
+ {
26
+ /* The libxml gem provides Ruby language bindings for GNOME's Libxml2
27
+ * XML toolkit. To get started you may:
28
+ *
29
+ * require 'test_helper'
30
+ * document = XML::Document.new
31
+ *
32
+ * However, when creating an application or library you plan to
33
+ * redistribute, it is best to not add the LibXML module to the global
34
+ * namespace, in which case you can either write your code like this:
35
+ *
36
+ * require 'libxml'
37
+ * document = LibXML::XML::Document.new
38
+ *
39
+ * Refer to the README file to get started and the LICENSE file for
40
+ * copyright and distribution information.
41
+ */
42
+
43
+ // Seutp for threading. http://xmlsoft.org/threads.html
44
+ xmlInitParser();
45
+
46
+ mLibXML = rb_define_module("LibXML");
47
+
48
+ rxml_init_memory();
49
+ rxml_init_xml();
50
+ rxml_init_io();
51
+ rxml_init_error();
52
+ rxml_init_encoding();
53
+ rxml_init_parser();
54
+ rxml_init_parser_context();
55
+ rxml_init_parser_options();
56
+ rxml_init_node();
57
+ rxml_init_attributes();
58
+ rxml_init_attr();
59
+ rxml_init_attr_decl();
60
+ rxml_init_document();
61
+ rxml_init_namespaces();
62
+ rxml_init_namespace();
63
+ rxml_init_sax_parser();
64
+ rxml_init_sax2_handler();
65
+ rxml_init_xinclude();
66
+ rxml_init_xpath();
67
+ rxml_init_xpath_object();
68
+ rxml_init_xpath_context();
69
+ rxml_init_xpath_expression();
70
+ rxml_init_xpointer();
71
+ rxml_init_html_parser();
72
+ rxml_init_html_parser_options();
73
+ rxml_init_html_parser_context();
74
+ rxml_init_input_callbacks();
75
+ rxml_init_dtd();
76
+ rxml_init_schema();
77
+ rxml_init_relaxng();
78
+ rxml_init_reader();
79
+ rxml_init_writer();
80
+ }
@@ -0,0 +1,35 @@
1
+ LIBRARY libxml_ruby.so
2
+ EXPORTS
3
+ Init_libxml_ruby
4
+ rxml_document_wrap
5
+ rxml_xpath_to_value
6
+ rxml_xpath_from_value
7
+
8
+ cXMLAttr DATA
9
+ cXMLAttrDecl DATA
10
+ cXMLAttributes DATA
11
+ cXMLDocument DATA
12
+ cXMLDtd DATA
13
+ cXMLHtmlParser DATA
14
+ cXMLHtmlParserContext DATA
15
+ cXMLNamespace DATA
16
+ cXMLNamespaces DATA
17
+ cXMLNode DATA
18
+ cXMLParser DATA
19
+ cXMLParserContext DATA
20
+ cXMLReader DATA
21
+ cXMLRelaxNG DATA
22
+ cXMLSaxParser DATA
23
+ cXMLSchema DATA
24
+ cXMLXInclude DATA
25
+ cXMLXPathContext DATA
26
+ cXMLXPathExpression DATA
27
+ cXMLXPathObject DATA
28
+ cXMLXPointer DATA
29
+ eXMLError DATA
30
+ mLibXML DATA
31
+ mXML DATA
32
+ mXMLEncoding DATA
33
+ mXMLHtmlParserOptions DATA
34
+ mXMLParserOptions DATA
35
+ mXPath DATA