libxml-ruby 2.0.0-x86-mingw32 → 2.0.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +33 -0
- data/LICENSE +2 -4
- data/README.rdoc +12 -14
- data/Rakefile +11 -4
- data/ext/libxml/extconf.h +5 -0
- data/ext/libxml/extconf.rb +2 -1
- data/ext/libxml/ruby_xml_attr.c +0 -2
- data/ext/libxml/ruby_xml_attr.h +0 -2
- data/ext/libxml/ruby_xml_attr_decl.c +0 -2
- data/ext/libxml/ruby_xml_attr_decl.h +0 -2
- data/ext/libxml/ruby_xml_attributes.c +0 -2
- data/ext/libxml/ruby_xml_attributes.h +0 -2
- data/ext/libxml/ruby_xml_document.c +0 -50
- data/ext/libxml/ruby_xml_document.h +0 -2
- data/ext/libxml/ruby_xml_encoding.c +0 -2
- data/ext/libxml/ruby_xml_encoding.h +0 -2
- data/ext/libxml/ruby_xml_error.c +0 -14
- data/ext/libxml/ruby_xml_error.h +0 -2
- data/ext/libxml/ruby_xml_html_parser.c +0 -2
- data/ext/libxml/ruby_xml_html_parser.h +0 -2
- data/ext/libxml/ruby_xml_html_parser_context.c +0 -2
- data/ext/libxml/ruby_xml_html_parser_context.h +0 -2
- data/ext/libxml/ruby_xml_html_parser_options.c +0 -2
- data/ext/libxml/ruby_xml_html_parser_options.h +0 -2
- data/ext/libxml/ruby_xml_io.c +0 -2
- data/ext/libxml/ruby_xml_namespace.c +12 -4
- data/ext/libxml/ruby_xml_namespace.h +0 -2
- data/ext/libxml/ruby_xml_namespaces.c +0 -2
- data/ext/libxml/ruby_xml_namespaces.h +0 -2
- data/ext/libxml/ruby_xml_node.h +0 -2
- data/ext/libxml/ruby_xml_parser.c +0 -2
- data/ext/libxml/ruby_xml_parser.h +0 -2
- data/ext/libxml/ruby_xml_parser_context.c +0 -2
- data/ext/libxml/ruby_xml_parser_context.h +0 -2
- data/ext/libxml/ruby_xml_parser_options.c +0 -2
- data/ext/libxml/ruby_xml_parser_options.h +0 -2
- data/ext/libxml/ruby_xml_sax2_handler.c +0 -2
- data/ext/libxml/ruby_xml_sax2_handler.h +0 -2
- data/ext/libxml/ruby_xml_sax_parser.c +0 -2
- data/ext/libxml/ruby_xml_sax_parser.h +0 -2
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/libxml/ruby_xml_xinclude.c +0 -2
- data/ext/libxml/ruby_xml_xinclude.h +0 -2
- data/ext/libxml/ruby_xml_xpath.c +0 -2
- data/ext/libxml/ruby_xml_xpath.h +0 -2
- data/ext/libxml/ruby_xml_xpath_context.c +0 -2
- data/ext/libxml/ruby_xml_xpath_context.h +0 -2
- data/ext/libxml/ruby_xml_xpath_expression.c +0 -2
- data/ext/libxml/ruby_xml_xpath_expression.h +0 -2
- data/ext/libxml/ruby_xml_xpath_object.c +0 -2
- data/ext/libxml/ruby_xml_xpath_object.h +0 -2
- data/ext/libxml/ruby_xml_xpointer.c +0 -2
- data/ext/libxml/ruby_xml_xpointer.h +0 -2
- data/lib/1.8/libxml_ruby.so +0 -0
- data/lib/1.9/libxml_ruby.so +0 -0
- data/lib/libs/libiconv-2.dll +0 -0
- data/lib/libs/libxml2-2.dll +0 -0
- data/lib/libs/libz.dll +0 -0
- data/lib/libxml/attr.rb +10 -0
- data/lib/libxml/document.rb +1 -1
- data/lib/libxml/node.rb +2 -2
- data/libxml-ruby.gemspec +2 -5
- data/test/tc_namespaces.rb +39 -6
- data/test/tc_xpath.rb +16 -1
- metadata +8 -6
- data/ext/mingw/Rakefile +0 -34
- data/ext/mingw/build.rake +0 -41
data/HISTORY
CHANGED
@@ -1,5 +1,38 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 2.0.1 / 2011-04-17 Charlie Savage
|
4
|
+
|
5
|
+
* Added binaries for windows (Charlie Savage).
|
6
|
+
|
7
|
+
* Update Ruby 1.9 encoding handling to support libxml versions older than
|
8
|
+
version 2.6.26 which was released on June 6, 2006 (Charlie Savage).
|
9
|
+
|
10
|
+
* Add publish_with_docs rake task - combines publishing the
|
11
|
+
website and docs (Anurag Priyam).
|
12
|
+
|
13
|
+
* Correctly copy the documentation directory (Anurag Priyam)
|
14
|
+
|
15
|
+
* Use relative link for rdoc so the links are correct on
|
16
|
+
both rubyforge and github (Anurag Priyam).
|
17
|
+
|
18
|
+
* Update Rakefile to use Hanna RDco template (Charlie Savage).
|
19
|
+
|
20
|
+
* Update dates on license file (Charlie Savage).
|
21
|
+
|
22
|
+
* Add api to allow setting of attribute namespaces. Fixes issue #10 (Charlie Savage).
|
23
|
+
|
24
|
+
* Remove old hack to call the on_error method. This hack isn't needed anymore
|
25
|
+
since a better workaround was put in place in the parser context. Fixes
|
26
|
+
This fixes issue #12 (Charlie Savage).
|
27
|
+
|
28
|
+
* Remove references to passing blocks to validation functions. The blocks are no
|
29
|
+
longer called since the bindings use libxml's structured error handling. See
|
30
|
+
issue #6 (Charlie Savage).
|
31
|
+
|
32
|
+
* Fix up comment in Document and Node. See issue #8 (Charlie Savage).
|
33
|
+
|
34
|
+
* Update website text (Charlie Savage).
|
35
|
+
|
3
36
|
== 2.0.0 / 2011-04-16 Charlie Savage
|
4
37
|
|
5
38
|
* Ruby 1.9.2 support. The biggest addition is encoding support.
|
data/LICENSE
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
Copyright (c) 2008-2009 Charlie Savage and contributors
|
1
|
+
Copyright (c) 2008-2011 Charlie Savage and contributors
|
3
2
|
Copyright (c) 2002-2007 Sean Chittenden and contributors
|
4
3
|
Copyright (c) 2001 Wai-Sun "Squidster" Chia
|
5
4
|
|
@@ -19,5 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
-
SOFTWARE.
|
23
|
-
|
21
|
+
SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -30,17 +30,14 @@ The easiest way to install libxml-ruby is via Ruby Gems. To install:
|
|
30
30
|
<tt>gem install libxml-ruby</tt>
|
31
31
|
|
32
32
|
If you are running Windows, make sure to install the Win32 RubyGem
|
33
|
-
which includes
|
34
|
-
against libxml2 version 2.7.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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++.
|
33
|
+
which includes prebuilt extensions for Ruby 1.8 and Ruby 1.9. These
|
34
|
+
extensions are built with MinGW32 against libxml2 version 2.7.8,
|
35
|
+
iconv version 1.13 and zlib version 1.2.5. Note these binaries
|
36
|
+
are available in the lib\libs directory. To use them, put them
|
37
|
+
someplace on your path.
|
38
|
+
|
39
|
+
The gem also includes a Microsoft VC++ 2010
|
40
|
+
solution (useful for debugging).
|
44
41
|
|
45
42
|
== Getting Started
|
46
43
|
Using libxml is easy. First decide what parser you want to use:
|
@@ -78,8 +75,9 @@ then install the libxslt gem which is available at
|
|
78
75
|
http://rubyforge.org/projects/libxsl/.
|
79
76
|
|
80
77
|
== Usage
|
81
|
-
For
|
82
|
-
to its
|
78
|
+
For information about using libxml-ruby please refer
|
79
|
+
to its documentation at http://libxml.rubyforge.org/rdoc/index.html.
|
80
|
+
Some tutorials are also available at https://github.com/xml4r/libxml-ruby/wiki.
|
83
81
|
|
84
82
|
All libxml classes are in the LibXML::XML module. The easiest
|
85
83
|
way to use libxml is to require 'xml'. This will mixin
|
@@ -136,7 +134,7 @@ From https://svn.concord.org/svn/projects/trunk/common/ruby/xml_benchmarks/
|
|
136
134
|
|
137
135
|
|
138
136
|
== Documentation
|
139
|
-
Documentation is
|
137
|
+
Documentation is available via rdoc. To generate the documentation,
|
140
138
|
run the the command 'rake doc'. libxml-ruby's online documentation
|
141
139
|
is generated using Hanna. To use hanna:
|
142
140
|
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require "rubygems"
|
4
4
|
require "rake/extensiontask"
|
5
5
|
require "rake/testtask"
|
6
|
-
require
|
6
|
+
require 'hanna/rdoctask'
|
7
7
|
require "grancher/task"
|
8
8
|
require "yaml"
|
9
9
|
|
@@ -30,13 +30,17 @@ end
|
|
30
30
|
|
31
31
|
# Setup Windows Gem
|
32
32
|
if RUBY_PLATFORM.match(/win32|mingw32/)
|
33
|
-
binaries = (FileList['lib/**/*.so'
|
33
|
+
binaries = (FileList['lib/**/*.so',
|
34
|
+
'lib/**/*dll'])
|
34
35
|
|
35
36
|
# Windows specification
|
36
37
|
win_spec = spec.clone
|
37
38
|
win_spec.platform = Gem::Platform::CURRENT
|
38
39
|
win_spec.files += binaries.to_a
|
39
40
|
|
41
|
+
# Unset extensions
|
42
|
+
win_spec.extensions = nil
|
43
|
+
|
40
44
|
# Rake task to build the windows package
|
41
45
|
Rake::GemPackageTask.new(win_spec) do |pkg|
|
42
46
|
pkg.package_dir = 'pkg'
|
@@ -78,5 +82,8 @@ Grancher::Task.new do |g|
|
|
78
82
|
# copy the website directory
|
79
83
|
g.directory 'web'
|
80
84
|
# and the rdoc directory
|
81
|
-
g.directory 'doc/libxml-ruby/rdoc' 'rdoc'
|
82
|
-
end
|
85
|
+
g.directory 'doc/libxml-ruby/rdoc', 'rdoc'
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "Build docs, and publish the website"
|
89
|
+
task :publish_with_docs => [:rdoc, :publish]
|
data/ext/libxml/extconf.rb
CHANGED
data/ext/libxml/ruby_xml_attr.c
CHANGED
data/ext/libxml/ruby_xml_attr.h
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
/* $Id$ */
|
2
|
-
|
3
1
|
/*
|
4
2
|
* Document-class: LibXML::XML::Document
|
5
3
|
*
|
@@ -81,21 +79,6 @@ VALUE rxml_document_wrap(xmlDocPtr xdoc)
|
|
81
79
|
return result;
|
82
80
|
}
|
83
81
|
|
84
|
-
static void LibXML_validity_warning(void * ctxt, const char * msg, va_list ap)
|
85
|
-
{
|
86
|
-
if (rb_block_given_p())
|
87
|
-
{
|
88
|
-
char buff[1024];
|
89
|
-
snprintf(buff, 1024, msg, ap);
|
90
|
-
rb_yield(rb_ary_new3(2, rb_str_new2(buff), Qfalse));
|
91
|
-
}
|
92
|
-
else
|
93
|
-
{
|
94
|
-
fprintf(stderr, "warning -- found validity error: ");
|
95
|
-
fprintf(stderr, msg, ap);
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
82
|
/*
|
100
83
|
* call-seq:
|
101
84
|
* XML::Document.alloc(xml_version = 1.0) -> document
|
@@ -771,21 +754,6 @@ static VALUE rxml_document_xinclude(VALUE self)
|
|
771
754
|
#endif
|
772
755
|
}
|
773
756
|
|
774
|
-
void LibXML_validity_error(void * ctxt, const char * msg, va_list ap)
|
775
|
-
{
|
776
|
-
if (rb_block_given_p())
|
777
|
-
{
|
778
|
-
char buff[1024];
|
779
|
-
snprintf(buff, 1024, msg, ap);
|
780
|
-
rb_yield(rb_ary_new3(2, rb_str_new2(buff), Qtrue));
|
781
|
-
}
|
782
|
-
else
|
783
|
-
{
|
784
|
-
fprintf(stderr, "error -- found validity error: ");
|
785
|
-
fprintf(stderr, msg, ap);
|
786
|
-
}
|
787
|
-
}
|
788
|
-
|
789
757
|
/*
|
790
758
|
* call-seq:
|
791
759
|
* document.order_elements!
|
@@ -806,10 +774,6 @@ static VALUE rxml_document_order_elements(VALUE self)
|
|
806
774
|
* document.validate_schema(schema) -> (true|false)
|
807
775
|
*
|
808
776
|
* Validate this document against the specified XML::Schema.
|
809
|
-
*
|
810
|
-
* If a block is provided it is used as an error handler for validaten errors.
|
811
|
-
* The block is called with two argument, the message and a flag indication
|
812
|
-
* if the message is an error (true) or a warning (false).
|
813
777
|
*/
|
814
778
|
static VALUE rxml_document_validate_schema(VALUE self, VALUE schema)
|
815
779
|
{
|
@@ -823,10 +787,6 @@ static VALUE rxml_document_validate_schema(VALUE self, VALUE schema)
|
|
823
787
|
|
824
788
|
vptr = xmlSchemaNewValidCtxt(xschema);
|
825
789
|
|
826
|
-
xmlSchemaSetValidErrors(vptr,
|
827
|
-
(xmlSchemaValidityErrorFunc) LibXML_validity_error,
|
828
|
-
(xmlSchemaValidityWarningFunc) LibXML_validity_warning, NULL);
|
829
|
-
|
830
790
|
is_invalid = xmlSchemaValidateDoc(vptr, xdoc);
|
831
791
|
xmlSchemaFreeValidCtxt(vptr);
|
832
792
|
if (is_invalid)
|
@@ -845,10 +805,6 @@ static VALUE rxml_document_validate_schema(VALUE self, VALUE schema)
|
|
845
805
|
* document.validate_schema(relaxng) -> (true|false)
|
846
806
|
*
|
847
807
|
* Validate this document against the specified XML::RelaxNG.
|
848
|
-
*
|
849
|
-
* If a block is provided it is used as an error handler for validaten errors.
|
850
|
-
* The block is called with two argument, the message and a flag indication
|
851
|
-
* if the message is an error (true) or a warning (false).
|
852
808
|
*/
|
853
809
|
static VALUE rxml_document_validate_relaxng(VALUE self, VALUE relaxng)
|
854
810
|
{
|
@@ -862,10 +818,6 @@ static VALUE rxml_document_validate_relaxng(VALUE self, VALUE relaxng)
|
|
862
818
|
|
863
819
|
vptr = xmlRelaxNGNewValidCtxt(xrelaxng);
|
864
820
|
|
865
|
-
xmlRelaxNGSetValidErrors(vptr,
|
866
|
-
(xmlRelaxNGValidityErrorFunc) LibXML_validity_error,
|
867
|
-
(xmlRelaxNGValidityWarningFunc) LibXML_validity_warning, NULL);
|
868
|
-
|
869
821
|
is_invalid = xmlRelaxNGValidateDoc(vptr, xdoc);
|
870
822
|
xmlRelaxNGFreeValidCtxt(vptr);
|
871
823
|
if (is_invalid)
|
@@ -896,8 +848,6 @@ static VALUE rxml_document_validate_dtd(VALUE self, VALUE dtd)
|
|
896
848
|
Data_Get_Struct(dtd, xmlDtd, xdtd);
|
897
849
|
|
898
850
|
ctxt.userData = &error;
|
899
|
-
ctxt.error = (xmlValidityErrorFunc) LibXML_validity_error;
|
900
|
-
ctxt.warning = (xmlValidityWarningFunc) LibXML_validity_warning;
|
901
851
|
|
902
852
|
ctxt.nodeNr = 0;
|
903
853
|
ctxt.nodeTab = NULL;
|
data/ext/libxml/ruby_xml_error.c
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
VALUE eXMLError;
|
6
6
|
static ID CALL_METHOD;
|
7
7
|
static ID ERROR_HANDLER_ID;
|
8
|
-
static ID ON_ERROR_METHOD;
|
9
8
|
|
10
9
|
/*
|
11
10
|
* Document-class: LibXML::XML::Error
|
@@ -144,18 +143,6 @@ static void structuredErrorFunc(void *userData, xmlErrorPtr xerror)
|
|
144
143
|
userData = ctxt->userData;
|
145
144
|
}
|
146
145
|
|
147
|
-
/* If the target has an on_error method call it. This
|
148
|
-
gets around a bug in libxml where a sax's structured
|
149
|
-
error handler is overriden by the global error handler. */
|
150
|
-
if (userData)
|
151
|
-
{
|
152
|
-
VALUE target = (VALUE) userData;
|
153
|
-
if (!NIL_P(target) && rb_respond_to(target, ON_ERROR_METHOD))
|
154
|
-
{
|
155
|
-
rb_funcall(target, ON_ERROR_METHOD, 1, error);
|
156
|
-
}
|
157
|
-
}
|
158
|
-
|
159
146
|
/* Now call global handler */
|
160
147
|
if (block != Qnil)
|
161
148
|
{
|
@@ -172,7 +159,6 @@ void rxml_raise(xmlErrorPtr xerror)
|
|
172
159
|
|
173
160
|
void rxml_init_error()
|
174
161
|
{
|
175
|
-
ON_ERROR_METHOD = rb_intern("on_error");
|
176
162
|
CALL_METHOD = rb_intern("call");
|
177
163
|
ERROR_HANDLER_ID = rb_intern("@@__error_handler_callback__");
|
178
164
|
|
data/ext/libxml/ruby_xml_error.h
CHANGED
data/ext/libxml/ruby_xml_io.c
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
/* $Id$ */
|
2
|
-
|
3
1
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
2
|
|
5
3
|
#include "ruby_libxml.h"
|
@@ -51,6 +49,16 @@ VALUE rxml_namespace_wrap(xmlNsPtr xns, RUBY_DATA_FUNC freeFunc)
|
|
51
49
|
}
|
52
50
|
}
|
53
51
|
|
52
|
+
static VALUE rxml_namespace_string(xmlNsPtr xns, const char* buffer)
|
53
|
+
{
|
54
|
+
const char* xencoding = NULL;
|
55
|
+
#if LIBXML_VERSION >= 20628
|
56
|
+
xencoding = xns->context ? xns->context->encoding : NULL;
|
57
|
+
#endif
|
58
|
+
return rxml_str_new2(buffer, xencoding);
|
59
|
+
}
|
60
|
+
|
61
|
+
|
54
62
|
/*
|
55
63
|
* call-seq:
|
56
64
|
* initialize(node, "prefix", "href") -> XML::Namespace
|
@@ -98,7 +106,7 @@ static VALUE rxml_namespace_href_get(VALUE self)
|
|
98
106
|
if (xns->href == NULL)
|
99
107
|
return Qnil;
|
100
108
|
else
|
101
|
-
return
|
109
|
+
return rxml_namespace_string(xns, (const char*) xns->href);
|
102
110
|
}
|
103
111
|
|
104
112
|
/*
|
@@ -133,7 +141,7 @@ static VALUE rxml_namespace_prefix_get(VALUE self)
|
|
133
141
|
if (xns->prefix == NULL)
|
134
142
|
return Qnil;
|
135
143
|
else
|
136
|
-
return
|
144
|
+
return rxml_namespace_string(xns, (const char*) xns->prefix);
|
137
145
|
}
|
138
146
|
|
139
147
|
/*
|
data/ext/libxml/ruby_xml_node.h
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/* Don't nuke this block! It is used for automatically updating the
|
2
2
|
* versions below. VERSION = string formatting, VERNUM = numbered
|
3
3
|
* version for inline testing: increment both or none at all.*/
|
4
|
-
#define RUBY_LIBXML_VERSION "2.0.
|
5
|
-
#define RUBY_LIBXML_VERNUM
|
4
|
+
#define RUBY_LIBXML_VERSION "2.0.2"
|
5
|
+
#define RUBY_LIBXML_VERNUM 202
|
6
6
|
#define RUBY_LIBXML_VER_MAJ 2
|
7
7
|
#define RUBY_LIBXML_VER_MIN 0
|
8
|
-
#define RUBY_LIBXML_VER_MIC
|
8
|
+
#define RUBY_LIBXML_VER_MIC 2
|
9
9
|
#define RUBY_LIBXML_VER_PATCH 0
|
data/ext/libxml/ruby_xml_xpath.c
CHANGED
data/ext/libxml/ruby_xml_xpath.h
CHANGED
data/lib/1.8/libxml_ruby.so
CHANGED
Binary file
|
data/lib/1.9/libxml_ruby.so
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/lib/libs/libz.dll
ADDED
Binary file
|
data/lib/libxml/attr.rb
CHANGED
@@ -48,6 +48,16 @@ module LibXML
|
|
48
48
|
not self.ns.nil?
|
49
49
|
end
|
50
50
|
|
51
|
+
# call-seq:
|
52
|
+
# attr.namespacess -> XML::Namespaces
|
53
|
+
#
|
54
|
+
# Returns this node's XML::Namespaces object,
|
55
|
+
# which is used to access the namespaces
|
56
|
+
# associated with this node.
|
57
|
+
def namespaces
|
58
|
+
@namespaces ||= XML::Namespaces.new(self)
|
59
|
+
end
|
60
|
+
|
51
61
|
#
|
52
62
|
# call-seq:
|
53
63
|
# attr.parent? -> (true|false)
|
data/lib/libxml/document.rb
CHANGED
data/lib/libxml/node.rb
CHANGED
@@ -228,12 +228,12 @@ module LibXML
|
|
228
228
|
node_type == DOCB_DOCUMENT_NODE
|
229
229
|
end
|
230
230
|
|
231
|
-
# Specifies if this is an
|
231
|
+
# Specifies if this is an doctype node
|
232
232
|
def doctype?
|
233
233
|
node_type == DOCUMENT_TYPE_NODE
|
234
234
|
end
|
235
235
|
|
236
|
-
# Specifies if this is an
|
236
|
+
# Specifies if this is an document node
|
237
237
|
def document?
|
238
238
|
node_type == DOCUMENT_NODE
|
239
239
|
end
|
data/libxml-ruby.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
3
|
# Determine the current version of the software
|
4
4
|
version = File.read('ext/libxml/ruby_xml_version.h').match(/\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/)[1]
|
@@ -15,10 +15,8 @@ FILES = FileList[
|
|
15
15
|
'ext/libxml/*.h',
|
16
16
|
'ext/libxml/*.c',
|
17
17
|
'ext/libxml/*.rb',
|
18
|
-
'ext/mingw/Rakefile',
|
19
|
-
'ext/mingw/build.rake',
|
20
18
|
'ext/vc/*.sln',
|
21
|
-
'ext/vc/*.
|
19
|
+
'ext/vc/*.vcprojx',
|
22
20
|
'lib/**/*.rb',
|
23
21
|
'script/**/*',
|
24
22
|
'test/**/*'
|
@@ -46,5 +44,4 @@ Gem::Specification.new do |spec|
|
|
46
44
|
|
47
45
|
spec.required_ruby_version = '>= 1.8.6'
|
48
46
|
spec.date = DateTime.now
|
49
|
-
spec.has_rdoc = true
|
50
47
|
end
|
data/test/tc_namespaces.rb
CHANGED
@@ -14,14 +14,21 @@ class TestNamespaces < Test::Unit::TestCase
|
|
14
14
|
@doc = nil
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def test_namespace_node
|
18
18
|
node = @doc.root
|
19
19
|
ns = node.namespaces.namespace
|
20
20
|
assert_equal('soap', ns.prefix)
|
21
21
|
assert_equal('http://schemas.xmlsoap.org/soap/envelope/', ns.href)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def test_namespace_attr
|
25
|
+
node = @doc.root
|
26
|
+
attr = node.attributes.get_attribute('encodingStyle')
|
27
|
+
assert_equal('soap', attr.ns.prefix)
|
28
|
+
assert_equal('soap', attr.namespaces.namespace.prefix)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_set_namespace_node
|
25
32
|
node = XML::Node.new('Envelope')
|
26
33
|
assert_equal('<Envelope/>', node.to_s)
|
27
34
|
|
@@ -35,6 +42,35 @@ class TestNamespaces < Test::Unit::TestCase
|
|
35
42
|
assert_equal("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"/>", node.to_s)
|
36
43
|
end
|
37
44
|
|
45
|
+
def test_set_namespace_attribute
|
46
|
+
# Create node
|
47
|
+
node = XML::Node.new('Envelope')
|
48
|
+
assert_equal('<Envelope/>', node.to_s)
|
49
|
+
|
50
|
+
# Create attribute
|
51
|
+
attr = XML::Attr.new(node, "encodingStyle", "http://www.w3.org/2001/12/soap-encoding")
|
52
|
+
assert_equal('<Envelope encodingStyle="http://www.w3.org/2001/12/soap-encoding"/>',
|
53
|
+
node.to_s)
|
54
|
+
|
55
|
+
# Create namespace attribute
|
56
|
+
ns = XML::Namespace.new(node, 'soap', 'http://schemas.xmlsoap.org/soap/envelope/')
|
57
|
+
assert_equal('<Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://www.w3.org/2001/12/soap-encoding"/>',
|
58
|
+
node.to_s)
|
59
|
+
assert_nil(node.namespaces.namespace)
|
60
|
+
|
61
|
+
# Now put the node in the soap namespace
|
62
|
+
node.namespaces.namespace = ns
|
63
|
+
assert_not_nil(node.namespaces.namespace)
|
64
|
+
assert_equal('<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://www.w3.org/2001/12/soap-encoding"/>',
|
65
|
+
node.to_s)
|
66
|
+
|
67
|
+
# Now put the attribute in the soap namespace
|
68
|
+
attr.namespaces.namespace = ns
|
69
|
+
assert_not_nil(node.namespaces.namespace)
|
70
|
+
assert_equal('<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"/>',
|
71
|
+
node.to_s)
|
72
|
+
end
|
73
|
+
|
38
74
|
def test_define_namespace
|
39
75
|
node = XML::Node.new('Envelope')
|
40
76
|
assert_equal('<Envelope/>', node.to_s)
|
@@ -91,7 +127,7 @@ class TestNamespaces < Test::Unit::TestCase
|
|
91
127
|
node = @doc.find_first('//ns1:IdAndName',
|
92
128
|
:ns1 => 'http://domain.somewhere.com')
|
93
129
|
|
94
|
-
|
130
|
+
node.namespaces.each do |namespace|
|
95
131
|
assert_instance_of(XML::Namespace, namespace)
|
96
132
|
end
|
97
133
|
end
|
@@ -127,9 +163,6 @@ class TestNamespaces < Test::Unit::TestCase
|
|
127
163
|
end
|
128
164
|
|
129
165
|
def test_find_by_prefix
|
130
|
-
node = @doc.find_first('//ns1:getManufacturerNamesResponse',
|
131
|
-
:ns1 => 'http://services.somewhere.com')
|
132
|
-
|
133
166
|
namespace = @doc.root.namespaces.find_by_prefix('soap')
|
134
167
|
|
135
168
|
assert_instance_of(XML::Namespace, namespace)
|
data/test/tc_xpath.rb
CHANGED
@@ -191,5 +191,20 @@ class TestXPath < Test::Unit::TestCase
|
|
191
191
|
nodes = doc.find("//object/param[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'wmode']")
|
192
192
|
assert_not_nil nodes
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
|
+
def test_invalid_expression
|
196
|
+
xml = LibXML::XML::Document.string('<a></a>')
|
197
|
+
|
198
|
+
# Using the expression twice used to cause a Segmentation Fault
|
199
|
+
error = assert_raise(XML::Error) do
|
200
|
+
xml.find('//a/')
|
201
|
+
end
|
202
|
+
assert_equal("Error: Invalid expression.", error.to_s)
|
203
|
+
|
204
|
+
# Try again - this used to cause a Segmentation Fault
|
205
|
+
error = assert_raise(XML::Error) do
|
206
|
+
xml.find('//a/')
|
207
|
+
end
|
208
|
+
assert_equal("Error: Invalid expression.", error.to_s)
|
209
|
+
end
|
195
210
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: libxml-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.0.
|
5
|
+
version: 2.0.2
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
8
8
|
- Ross Bamform
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-18 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -23,8 +23,8 @@ description: " The Libxml-Ruby project provides Ruby language bindings for th
|
|
23
23
|
email:
|
24
24
|
executables: []
|
25
25
|
|
26
|
-
extensions:
|
27
|
-
|
26
|
+
extensions: []
|
27
|
+
|
28
28
|
extra_rdoc_files: []
|
29
29
|
|
30
30
|
files:
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- Rakefile
|
36
36
|
- README.rdoc
|
37
37
|
- setup.rb
|
38
|
+
- ext/libxml/extconf.h
|
38
39
|
- ext/libxml/ruby_libxml.h
|
39
40
|
- ext/libxml/ruby_xml.h
|
40
41
|
- ext/libxml/ruby_xml_attr.h
|
@@ -100,8 +101,6 @@ files:
|
|
100
101
|
- ext/libxml/ruby_xml_xpath_object.c
|
101
102
|
- ext/libxml/ruby_xml_xpointer.c
|
102
103
|
- ext/libxml/extconf.rb
|
103
|
-
- ext/mingw/Rakefile
|
104
|
-
- ext/mingw/build.rake
|
105
104
|
- ext/vc/libxml_ruby.sln
|
106
105
|
- lib/libxml/attr.rb
|
107
106
|
- lib/libxml/attributes.rb
|
@@ -190,6 +189,9 @@ files:
|
|
190
189
|
- test/test_suite.rb
|
191
190
|
- lib/1.8/libxml_ruby.so
|
192
191
|
- lib/1.9/libxml_ruby.so
|
192
|
+
- lib/libs/libiconv-2.dll
|
193
|
+
- lib/libs/libxml2-2.dll
|
194
|
+
- lib/libs/libz.dll
|
193
195
|
has_rdoc: true
|
194
196
|
homepage: http://xml4r.github.com/libxml-ruby
|
195
197
|
licenses: []
|
data/ext/mingw/Rakefile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# We can't use Ruby's standard build procedures
|
2
|
-
# on Windows because the Ruby executable is
|
3
|
-
# built with VC++ while here we want to build
|
4
|
-
# with MingW. So just roll our own...
|
5
|
-
|
6
|
-
require 'fileutils'
|
7
|
-
require 'rbconfig'
|
8
|
-
|
9
|
-
EXTENSION_NAME = "libxml_ruby.#{Config::CONFIG["DLEXT"]}"
|
10
|
-
|
11
|
-
# MingW insists the import library is .dll.a
|
12
|
-
EXTENSION_LIB_NAME = "libxml_ruby.dll.a"
|
13
|
-
|
14
|
-
# This is called when the Windows GEM is installed!
|
15
|
-
task :install do
|
16
|
-
# Gems will pass these two environment variables:
|
17
|
-
# RUBYARCHDIR=#{dest_path}
|
18
|
-
# RUBYLIBDIR=#{dest_path}
|
19
|
-
|
20
|
-
dest_path = ENV['RUBYLIBDIR']
|
21
|
-
|
22
|
-
# Copy the extension
|
23
|
-
cp(EXTENSION_NAME, dest_path)
|
24
|
-
|
25
|
-
# Copy the import library (used by libxslt)
|
26
|
-
cp(EXTENSION_LIB_NAME, dest_path)
|
27
|
-
|
28
|
-
# Copy dlls
|
29
|
-
Dir.glob('*.dll').each do |dll|
|
30
|
-
cp(dll, dest_path)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
task :default => :install
|
data/ext/mingw/build.rake
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# We can't use Ruby's standard build procedures
|
2
|
-
# on Windows because the Ruby executable is
|
3
|
-
# built with VC++ while here we want to build
|
4
|
-
# with MingW. So just roll our own...
|
5
|
-
|
6
|
-
require 'rake/clean'
|
7
|
-
require 'rbconfig'
|
8
|
-
|
9
|
-
RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
|
10
|
-
RUBY_BIN_DIR = Config::CONFIG["bindir"]
|
11
|
-
RUBY_LIB_DIR = Config::CONFIG["libdir"]
|
12
|
-
RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
|
13
|
-
RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/^lib/, '').gsub(/lib$/, 'dll').gsub(/\.a$/, '')
|
14
|
-
|
15
|
-
EXTENSION_NAME = "libxml_ruby.#{Config::CONFIG["DLEXT"]}"
|
16
|
-
# MingW insists the import library is .dll.a
|
17
|
-
EXTENSION_LIB_NAME = "libxml_ruby.dll.a"
|
18
|
-
|
19
|
-
CLEAN.include('*.o')
|
20
|
-
CLOBBER.include(EXTENSION_NAME)
|
21
|
-
CLOBBER.include(EXTENSION_LIB_NAME)
|
22
|
-
|
23
|
-
task :default => "libxml"
|
24
|
-
|
25
|
-
SRC = FileList['../libxml/*.c']
|
26
|
-
OBJ = SRC.collect do |file_name|
|
27
|
-
File.basename(file_name).ext('o')
|
28
|
-
end
|
29
|
-
|
30
|
-
SRC.each do |srcfile|
|
31
|
-
objfile = File.basename(srcfile).ext('o')
|
32
|
-
file objfile => srcfile do
|
33
|
-
command = "gcc -c -O2 -Wall -o #{objfile} -I/usr/local/include/libxml2 #{srcfile} -I#{RUBY_INCLUDE_DIR}"
|
34
|
-
sh "sh -c '#{command}'"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
file "libxml" => OBJ do
|
39
|
-
command = "gcc -shared -Wl,--enable-auto-import -o #{EXTENSION_NAME} -Wl,--out-implib,#{EXTENSION_LIB_NAME} -L/usr/local/lib #{OBJ} -lxml2 #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}"
|
40
|
-
sh "sh -c '#{command}'"
|
41
|
-
end
|