libxml-ruby 2.0.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/HISTORY +516 -0
  2. data/LICENSE +23 -0
  3. data/MANIFEST +165 -0
  4. data/README.rdoc +161 -0
  5. data/Rakefile +82 -0
  6. data/ext/libxml/extconf.rb +122 -0
  7. data/ext/libxml/libxml.c +93 -0
  8. data/ext/libxml/ruby_libxml.h +101 -0
  9. data/ext/libxml/ruby_xml.c +893 -0
  10. data/ext/libxml/ruby_xml.h +10 -0
  11. data/ext/libxml/ruby_xml_attr.c +352 -0
  12. data/ext/libxml/ruby_xml_attr.h +14 -0
  13. data/ext/libxml/ruby_xml_attr_decl.c +171 -0
  14. data/ext/libxml/ruby_xml_attr_decl.h +13 -0
  15. data/ext/libxml/ruby_xml_attributes.c +277 -0
  16. data/ext/libxml/ruby_xml_attributes.h +17 -0
  17. data/ext/libxml/ruby_xml_cbg.c +85 -0
  18. data/ext/libxml/ruby_xml_document.c +958 -0
  19. data/ext/libxml/ruby_xml_document.h +17 -0
  20. data/ext/libxml/ruby_xml_dtd.c +257 -0
  21. data/ext/libxml/ruby_xml_dtd.h +9 -0
  22. data/ext/libxml/ruby_xml_encoding.c +221 -0
  23. data/ext/libxml/ruby_xml_encoding.h +16 -0
  24. data/ext/libxml/ruby_xml_error.c +1004 -0
  25. data/ext/libxml/ruby_xml_error.h +14 -0
  26. data/ext/libxml/ruby_xml_html_parser.c +92 -0
  27. data/ext/libxml/ruby_xml_html_parser.h +12 -0
  28. data/ext/libxml/ruby_xml_html_parser_context.c +308 -0
  29. data/ext/libxml/ruby_xml_html_parser_context.h +12 -0
  30. data/ext/libxml/ruby_xml_html_parser_options.c +40 -0
  31. data/ext/libxml/ruby_xml_html_parser_options.h +12 -0
  32. data/ext/libxml/ruby_xml_input_cbg.c +191 -0
  33. data/ext/libxml/ruby_xml_input_cbg.h +20 -0
  34. data/ext/libxml/ruby_xml_io.c +30 -0
  35. data/ext/libxml/ruby_xml_io.h +9 -0
  36. data/ext/libxml/ruby_xml_namespace.c +170 -0
  37. data/ext/libxml/ruby_xml_namespace.h +12 -0
  38. data/ext/libxml/ruby_xml_namespaces.c +295 -0
  39. data/ext/libxml/ruby_xml_namespaces.h +11 -0
  40. data/ext/libxml/ruby_xml_node.c +1386 -0
  41. data/ext/libxml/ruby_xml_node.h +13 -0
  42. data/ext/libxml/ruby_xml_parser.c +94 -0
  43. data/ext/libxml/ruby_xml_parser.h +14 -0
  44. data/ext/libxml/ruby_xml_parser_context.c +982 -0
  45. data/ext/libxml/ruby_xml_parser_context.h +12 -0
  46. data/ext/libxml/ruby_xml_parser_options.c +68 -0
  47. data/ext/libxml/ruby_xml_parser_options.h +14 -0
  48. data/ext/libxml/ruby_xml_reader.c +1057 -0
  49. data/ext/libxml/ruby_xml_reader.h +14 -0
  50. data/ext/libxml/ruby_xml_relaxng.c +111 -0
  51. data/ext/libxml/ruby_xml_relaxng.h +10 -0
  52. data/ext/libxml/ruby_xml_sax2_handler.c +334 -0
  53. data/ext/libxml/ruby_xml_sax2_handler.h +12 -0
  54. data/ext/libxml/ruby_xml_sax_parser.c +136 -0
  55. data/ext/libxml/ruby_xml_sax_parser.h +12 -0
  56. data/ext/libxml/ruby_xml_schema.c +159 -0
  57. data/ext/libxml/ruby_xml_schema.h +11 -0
  58. data/ext/libxml/ruby_xml_version.h +9 -0
  59. data/ext/libxml/ruby_xml_xinclude.c +18 -0
  60. data/ext/libxml/ruby_xml_xinclude.h +13 -0
  61. data/ext/libxml/ruby_xml_xpath.c +107 -0
  62. data/ext/libxml/ruby_xml_xpath.h +12 -0
  63. data/ext/libxml/ruby_xml_xpath_context.c +390 -0
  64. data/ext/libxml/ruby_xml_xpath_context.h +11 -0
  65. data/ext/libxml/ruby_xml_xpath_expression.c +83 -0
  66. data/ext/libxml/ruby_xml_xpath_expression.h +12 -0
  67. data/ext/libxml/ruby_xml_xpath_object.c +336 -0
  68. data/ext/libxml/ruby_xml_xpath_object.h +19 -0
  69. data/ext/libxml/ruby_xml_xpointer.c +101 -0
  70. data/ext/libxml/ruby_xml_xpointer.h +13 -0
  71. data/ext/mingw/Rakefile +34 -0
  72. data/ext/mingw/build.rake +41 -0
  73. data/ext/vc/libxml_ruby.sln +26 -0
  74. data/lib/1.8/libxml_ruby.so +0 -0
  75. data/lib/1.9/libxml_ruby.so +0 -0
  76. data/lib/libxml.rb +30 -0
  77. data/lib/libxml/attr.rb +113 -0
  78. data/lib/libxml/attr_decl.rb +80 -0
  79. data/lib/libxml/attributes.rb +14 -0
  80. data/lib/libxml/document.rb +192 -0
  81. data/lib/libxml/error.rb +90 -0
  82. data/lib/libxml/hpricot.rb +78 -0
  83. data/lib/libxml/html_parser.rb +96 -0
  84. data/lib/libxml/namespace.rb +62 -0
  85. data/lib/libxml/namespaces.rb +38 -0
  86. data/lib/libxml/node.rb +399 -0
  87. data/lib/libxml/ns.rb +22 -0
  88. data/lib/libxml/parser.rb +367 -0
  89. data/lib/libxml/properties.rb +23 -0
  90. data/lib/libxml/reader.rb +29 -0
  91. data/lib/libxml/sax_callbacks.rb +180 -0
  92. data/lib/libxml/sax_parser.rb +58 -0
  93. data/lib/libxml/tree.rb +29 -0
  94. data/lib/libxml/xpath_object.rb +16 -0
  95. data/lib/xml.rb +16 -0
  96. data/lib/xml/libxml.rb +10 -0
  97. data/libxml-ruby.gemspec +50 -0
  98. data/script/benchmark/depixelate +634 -0
  99. data/script/benchmark/hamlet.xml +9055 -0
  100. data/script/benchmark/parsecount +170 -0
  101. data/script/benchmark/sock_entries.xml +507 -0
  102. data/script/benchmark/throughput +41 -0
  103. data/script/test +6 -0
  104. data/setup.rb +1585 -0
  105. data/test/etc_doc_to_s.rb +21 -0
  106. data/test/ets_doc_file.rb +17 -0
  107. data/test/ets_doc_to_s.rb +23 -0
  108. data/test/ets_gpx.rb +28 -0
  109. data/test/ets_node_gc.rb +23 -0
  110. data/test/ets_test.xml +2 -0
  111. data/test/ets_tsr.rb +11 -0
  112. data/test/model/atom.xml +13 -0
  113. data/test/model/bands.iso-8859-1.xml +5 -0
  114. data/test/model/bands.utf-8.xml +5 -0
  115. data/test/model/bands.xml +5 -0
  116. data/test/model/books.xml +146 -0
  117. data/test/model/merge_bug_data.xml +58 -0
  118. data/test/model/ruby-lang.html +238 -0
  119. data/test/model/rubynet.xml +79 -0
  120. data/test/model/rubynet_project +1 -0
  121. data/test/model/shiporder.rnc +28 -0
  122. data/test/model/shiporder.rng +86 -0
  123. data/test/model/shiporder.xml +23 -0
  124. data/test/model/shiporder.xsd +31 -0
  125. data/test/model/soap.xml +27 -0
  126. data/test/model/xinclude.xml +5 -0
  127. data/test/rb-magic-comment.rb +33 -0
  128. data/test/tc_attr.rb +181 -0
  129. data/test/tc_attr_decl.rb +133 -0
  130. data/test/tc_attributes.rb +135 -0
  131. data/test/tc_deprecated_require.rb +13 -0
  132. data/test/tc_document.rb +119 -0
  133. data/test/tc_document_write.rb +187 -0
  134. data/test/tc_dtd.rb +125 -0
  135. data/test/tc_error.rb +138 -0
  136. data/test/tc_html_parser.rb +140 -0
  137. data/test/tc_namespace.rb +62 -0
  138. data/test/tc_namespaces.rb +177 -0
  139. data/test/tc_node.rb +258 -0
  140. data/test/tc_node_cdata.rb +51 -0
  141. data/test/tc_node_comment.rb +33 -0
  142. data/test/tc_node_copy.rb +42 -0
  143. data/test/tc_node_edit.rb +160 -0
  144. data/test/tc_node_text.rb +71 -0
  145. data/test/tc_node_write.rb +108 -0
  146. data/test/tc_node_xlink.rb +29 -0
  147. data/test/tc_parser.rb +336 -0
  148. data/test/tc_parser_context.rb +189 -0
  149. data/test/tc_properties.rb +39 -0
  150. data/test/tc_reader.rb +298 -0
  151. data/test/tc_relaxng.rb +54 -0
  152. data/test/tc_sax_parser.rb +276 -0
  153. data/test/tc_schema.rb +53 -0
  154. data/test/tc_traversal.rb +222 -0
  155. data/test/tc_xinclude.rb +21 -0
  156. data/test/tc_xml.rb +226 -0
  157. data/test/tc_xpath.rb +195 -0
  158. data/test/tc_xpath_context.rb +80 -0
  159. data/test/tc_xpath_expression.rb +38 -0
  160. data/test/tc_xpointer.rb +74 -0
  161. data/test/test_helper.rb +14 -0
  162. data/test/test_suite.rb +39 -0
  163. metadata +254 -0
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+
2
+ Copyright (c) 2008-2009 Charlie Savage and contributors
3
+ Copyright (c) 2002-2007 Sean Chittenden and contributors
4
+ Copyright (c) 2001 Wai-Sun "Squidster" Chia
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
+
@@ -0,0 +1,165 @@
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/tc_attr.rb
126
+ test/tc_attr_decl.rb
127
+ test/tc_attributes.rb
128
+ test/tc_deprecated_require.rb
129
+ test/tc_document.rb
130
+ test/tc_document_write.rb
131
+ test/tc_dtd.rb
132
+ test/tc_error.rb
133
+ test/tc_html_parser.rb
134
+ test/tc_namespace.rb
135
+ test/tc_namespaces.rb
136
+ test/tc_node.rb
137
+ test/tc_node_cdata.rb
138
+ test/tc_node_comment.rb
139
+ test/tc_node_copy.rb
140
+ test/tc_node_edit.rb
141
+ test/tc_node_text.rb
142
+ test/tc_node_write.rb
143
+ test/tc_node_xlink.rb
144
+ test/tc_parser.rb
145
+ test/tc_parser_context.rb
146
+ test/tc_properties.rb
147
+ test/tc_reader.rb
148
+ test/tc_relaxng.rb
149
+ test/tc_sax_parser.rb
150
+ test/tc_schema.rb
151
+ test/tc_traversal.rb
152
+ test/tc_xinclude.rb
153
+ test/tc_xml.rb
154
+ test/tc_xpath.rb
155
+ test/tc_xpath_context.rb
156
+ test/tc_xpath_expression.rb
157
+ test/tc_xpointer.rb
158
+ test/test_suite.rb
159
+ Rakefile
160
+ HISTORY.rdoc
161
+ PROFILE
162
+ TODO
163
+ LICENSE
164
+ README.rdoc
165
+ VERSION
@@ -0,0 +1,161 @@
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.4 or higher. It is dependent on
15
+ the following libraries to function properly:
16
+
17
+ * libm (math routines: very standard)
18
+ * libz (zlib)
19
+ * libiconv
20
+ * libxml2
21
+
22
+ If you are running Linux or Unix you'll need a C compiler so the
23
+ extension can be compiled when it is installed. If you are running
24
+ Windows, then install the Windows specific RubyGem which
25
+ includes an already built extension.
26
+
27
+ == INSTALLATION
28
+ The easiest way to install libxml-ruby is via Ruby Gems. To install:
29
+
30
+ <tt>gem install libxml-ruby</tt>
31
+
32
+ If you are running Windows, make sure to install the Win32 RubyGem
33
+ which includes an already built binary file. The binary is built
34
+ against libxml2 version 2.7.2 and iconv version 1.11. Both of these
35
+ are also included as pre-built binaries, and should be put either in
36
+ the libxml/lib directory or on the Windows path. Due to a bug
37
+ in ruby-gems, you cannot install the gem to a path that contains
38
+ spaces (see http://rubyforge.org/tracker/?func=detail&aid=23003&group_id=126&atid=577).
39
+
40
+ The Windows binaries are built with MingW and include libxml-ruby,
41
+ libxml2 and iconv. The gem also includes a Microsoft VC++ 2008
42
+ solution. If you wish to run a debug version of libxml-ruby on
43
+ Windows, then it is highly recommended you use VC++.
44
+
45
+ == Getting Started
46
+ Using libxml is easy. First decide what parser you want to use:
47
+
48
+ * Generally you'll want to use the LibXML::XML::Parser which provides a tree based API.
49
+ * For larger documents that don't fit into memory, or if you prefer an input based API, use the LibXML::XML::Reader.
50
+ * To parse HTML files use LibXML::XML::HTMLParser.
51
+ * If you are masochistic, then use the LibXML::XML::SaxParser, which provides a callback API.
52
+
53
+ Once you have chosen a parser, choose a datasource. Libxml can parse files, strings, URIs
54
+ and IO streams. For each data source you can specify an LibXML::XML::Encoding, a base uri and
55
+ various parser options. For more information, refer the LibXML::XML::Parser.document,
56
+ LibXML::XML::Parser.file, LibXML::XML::Parser.io or LibXML:::XML::Parser.string methods (the
57
+ same methods are defined on all four parser classes).
58
+
59
+ == Advanced Functionality
60
+ Beyond the basics of parsing and processing XML and HTML documents,
61
+ libxml provides a wealth of additional functionality.
62
+
63
+ Most commonly, you'll want to use its LibXML::XML::XPath support, which makes
64
+ it easy to find data inside a XML document. Although not as popular,
65
+ LibXML::XML::XPointer provides another API for finding data inside an XML document.
66
+
67
+ Often times you'll need to validate data before processing it. For example,
68
+ if you accept user generated content submitted over the Web, you'll
69
+ want to verify that it does not contain malicious code such as embedded scripts.
70
+ This can be done using libxml's powerful set of validators:
71
+
72
+ * DTDs (LibXML::XML::Dtd)
73
+ * Relax Schemas (LibXML::XML::RelaxNG)
74
+ * XML Schema (LibXML::XML::Schema)
75
+
76
+ Finally, if you'd like to use XSL Transformations to process data,
77
+ then install the libxslt gem which is available at
78
+ http://rubyforge.org/projects/libxsl/.
79
+
80
+ == Usage
81
+ For in-depth information about using libxml-ruby please refer
82
+ to its online Rdoc documentation.
83
+
84
+ All libxml classes are in the LibXML::XML module. The easiest
85
+ way to use libxml is to require 'xml'. This will mixin
86
+ the LibXML module into the global namespace, allowing you to
87
+ write code like this:
88
+
89
+ require 'xml'
90
+ document = XML::Document.new
91
+
92
+ However, when creating an application or library you plan to
93
+ redistribute, it is best to not add the LibXML module to the global
94
+ namespace, in which case you can either write your code like this:
95
+
96
+ require 'libxml'
97
+ document = LibXML::XML::Document.new
98
+
99
+ Or you can utilize a namespace for you own work and include LibXML into it.
100
+ For example:
101
+
102
+ require 'libxml'
103
+
104
+ mdoule MyApplication
105
+ include LibXML
106
+
107
+ class MyClass
108
+ def some_method
109
+ document = XML::Document.new
110
+ end
111
+ end
112
+ end
113
+
114
+ For simplicity's sake, the documentation uses the xml module in its examples.
115
+
116
+ == Performance
117
+ In addition to being feature rich and conformation, the main reason
118
+ people use libxml-ruby is for performance. Here are the results
119
+ of a couple simple benchmarks recently blogged about on the
120
+ Web (you can find them in the benchmark directory of the
121
+ libxml distribution).
122
+
123
+ From http://depixelate.com/2008/4/23/ruby-xml-parsing-benchmarks
124
+
125
+ user system total real
126
+ libxml 0.032000 0.000000 0.032000 ( 0.031000)
127
+ Hpricot 0.640000 0.031000 0.671000 ( 0.890000)
128
+ REXML 1.813000 0.047000 1.860000 ( 2.031000)
129
+
130
+ From https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks/
131
+
132
+ user system total real
133
+ libxml 0.641000 0.031000 0.672000 ( 0.672000)
134
+ hpricot 5.359000 0.062000 5.421000 ( 5.516000)
135
+ rexml 22.859000 0.047000 22.906000 ( 23.203000)
136
+
137
+
138
+ == Documentation
139
+ Documentation is provided via rdoc. To generate the documentation,
140
+ run the the command 'rake doc'. libxml-ruby's online documentation
141
+ is generated using Hanna. To use hanna:
142
+
143
+ gem install mislav-hanna
144
+ rake rdoc RDOCOPT="-S -T hanna"
145
+
146
+ Note that older versions of Rdoc, which ship with Ruby 1.8.x, will report
147
+ a number of errors. To avoid them, install Rdoc 2.1 or higher from
148
+ RubyForge (http://rdoc.rubyforge.org/). Once you have installed the gem,
149
+ you'll have to disable the version of Rdoc that Ruby 1.8.x includes. An
150
+ easy way to do that is rename the directory uby/lib/ruby/1.8/rdoc to
151
+ ruby/lib/ruby/1.8/rdoc_old.
152
+
153
+ == Support
154
+
155
+ If you have any questions about using libxml-ruby, please send them to
156
+ libxml-devel@rubyforge.org. If you have found any bugs in libxml-devel,
157
+ or have developed new patches, please submit them to Ruby Forge at
158
+ http://rubyforge.org/tracker/?group_id=494.
159
+
160
+ == License
161
+ See LICENSE for license information.
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "rake/extensiontask"
5
+ require "rake/testtask"
6
+ require "rake/rdoctask"
7
+ require "grancher/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
+ # Setup compile tasks
17
+ Rake::ExtensionTask.new do |ext|
18
+ ext.gem_spec = spec
19
+ ext.name = SO_NAME
20
+ ext.ext_dir = "ext/libxml"
21
+ ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
22
+ ext.config_options << "--with-xml2-include=C:/MinGW/local/include/libxml2"
23
+ end
24
+
25
+ # Setup generic gem
26
+ Rake::GemPackageTask.new(spec) do |pkg|
27
+ pkg.package_dir = 'pkg'
28
+ pkg.need_tar = false
29
+ end
30
+
31
+ # Setup Windows Gem
32
+ if RUBY_PLATFORM.match(/win32|mingw32/)
33
+ binaries = (FileList['lib/**/*.so'])
34
+
35
+ # Windows specification
36
+ win_spec = spec.clone
37
+ win_spec.platform = Gem::Platform::CURRENT
38
+ win_spec.files += binaries.to_a
39
+
40
+ # Rake task to build the windows package
41
+ Rake::GemPackageTask.new(win_spec) do |pkg|
42
+ pkg.package_dir = 'pkg'
43
+ pkg.need_tar = false
44
+ end
45
+ end
46
+
47
+ # RDoc Task
48
+ desc "Generate rdoc documentation"
49
+ Rake::RDocTask.new("rdoc") do |rdoc|
50
+ rdoc.rdoc_dir = 'doc/libxml-ruby/rdoc'
51
+ rdoc.title = "LibXML"
52
+ # Show source inline with line numbers
53
+ rdoc.options << "--line-numbers"
54
+ # Make the readme file the start page for the generated html
55
+ rdoc.main = 'README.rdoc'
56
+ rdoc.rdoc_files.include('doc/*.rdoc',
57
+ 'ext/**/libxml.c',
58
+ 'ext/**/ruby_xml.c',
59
+ 'ext/**/*.c',
60
+ 'lib/**/*.rb',
61
+ 'README.rdoc',
62
+ 'HISTORY',
63
+ 'LICENSE')
64
+ end
65
+
66
+ # Test Task
67
+ Rake::TestTask.new do |t|
68
+ t.libs << "test"
69
+ t.verbose = true
70
+ end
71
+
72
+ # Publish Website to Github
73
+ Grancher::Task.new do |g|
74
+ # push gh-pages
75
+ g.branch = 'gh-pages'
76
+ # to origin
77
+ g.push_to = 'origin'
78
+ # copy the website directory
79
+ g.directory 'web'
80
+ # and the rdoc directory
81
+ g.directory 'doc/libxml-ruby/rdoc' 'rdoc'
82
+ end
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rbconfig'
4
+
5
+ def method_missing(s, *args)
6
+ if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
7
+ return v
8
+ else
9
+ puts "missing: #{s}"
10
+ super
11
+ end
12
+ end
13
+
14
+ require 'mkmf'
15
+
16
+ if defined?(CFLAGS)
17
+ if CFLAGS.index(CONFIG['CCDLFLAGS'])
18
+ $CFLAGS = CFLAGS + ' ' + CONFIG['CCDLFLAGS']
19
+ else
20
+ $CFLAGS = CFLAGS
21
+ end
22
+ else
23
+ $CFLAGS = CONFIG['CFLAGS']
24
+ end
25
+ $LDFLAGS = CONFIG['LDFLAGS']
26
+ $LIBPATH.push(Config::CONFIG['libdir'])
27
+
28
+ def crash(str)
29
+ printf(" extconf failure: %s\n", str)
30
+ exit 1
31
+ end
32
+
33
+ dir_config('iconv')
34
+ dir_config('zlib')
35
+
36
+ have_library('socket','socket')
37
+ have_library('nsl','gethostbyname')
38
+
39
+ unless have_library('m', 'atan')
40
+ # try again for gcc 4.0
41
+ saveflags = $CFLAGS
42
+ $CFLAGS += ' -fno-builtin'
43
+ unless have_library('m', 'atan')
44
+ crash('need libm')
45
+ end
46
+ $CFLAGS = saveflags
47
+ end
48
+
49
+ unless have_library('z', 'inflate') or
50
+ have_library('zlib', 'inflate') or
51
+ have_library('zlib1', 'inflate')
52
+ crash('need zlib')
53
+ else
54
+ $defs.push('-DHAVE_ZLIB_H')
55
+ end
56
+
57
+ unless have_library('iconv','iconv_open') or
58
+ have_library('iconv','libiconv_open') or
59
+ have_library('libiconv', 'libiconv_open') or
60
+ have_library('libiconv', 'iconv_open') or
61
+ have_library('c','iconv_open') or
62
+ have_library('recode','iconv_open') or
63
+ have_library('iconv')
64
+ crash(<<EOL)
65
+ need libiconv.
66
+
67
+ Install the libiconv or try passing one of the following options
68
+ to extconf.rb:
69
+
70
+ --with-iconv-dir=/path/to/iconv
71
+ --with-iconv-lib=/path/to/iconv/lib
72
+ --with-iconv-include=/path/to/iconv/include
73
+ EOL
74
+ end
75
+
76
+ if (xc = with_config('xml2-config')) or RUBY_PLATFORM.match(/darwin/i) then
77
+ xc = 'xml2-config' if xc == true or xc.nil?
78
+ cflags = `#{xc} --cflags`.chomp
79
+ if $? != 0
80
+ cflags = nil
81
+ else
82
+ libs = `#{xc} --libs`.chomp
83
+ if $? != 0
84
+ libs = nil
85
+ else
86
+ $CFLAGS += ' ' + cflags
87
+ $libs = libs + " " + $libs
88
+ end
89
+ end
90
+ else
91
+ dir_config('xml2')
92
+ end
93
+
94
+ unless (have_library('xml2', 'xmlParseDoc') or
95
+ have_library('libxml2', 'xmlParseDoc') or
96
+ find_library('xml2', 'xmlParseDoc', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
97
+ (have_header('libxml/xmlversion.h') or
98
+ find_header('libxml/xmlversion.h',
99
+ '/opt/include/libxml2',
100
+ '/usr/local/include/libxml2',
101
+ '/usr/include/libxml2'))
102
+ crash(<<EOL)
103
+ need libxml2.
104
+
105
+ Install the library or try one of the following options to extconf.rb:
106
+
107
+ --with-xml2-config=/path/to/xml2-config
108
+ --with-xml2-dir=/path/to/libxml2
109
+ --with-xml2-lib=/path/to/libxml2/lib
110
+ --with-xml2-include=/path/to/libxml2/include
111
+ EOL
112
+ end
113
+
114
+ # For FreeBSD add /usr/local/include
115
+ $INCFLAGS << " -I/usr/local/include"
116
+
117
+ $CFLAGS << ' ' << $INCFLAGS
118
+
119
+ #$INSTALLFILES = [["libxml.rb", "$(RUBYLIBDIR)", "../xml"]]
120
+
121
+ create_header()
122
+ create_makefile('libxml_ruby')