libxml-ruby 2.7.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/HISTORY +33 -11
- data/README.rdoc +7 -7
- data/Rakefile +80 -77
- data/ext/libxml/extconf.h +4 -5
- data/ext/libxml/extconf.rb +57 -118
- data/ext/libxml/libxml.c +4 -0
- data/ext/libxml/ruby_xml.c +977 -893
- data/ext/libxml/ruby_xml.h +20 -10
- data/ext/libxml/ruby_xml_attr.c +333 -333
- data/ext/libxml/ruby_xml_attr_decl.c +2 -2
- data/ext/libxml/ruby_xml_cbg.c +85 -85
- data/ext/libxml/ruby_xml_document.c +1133 -1147
- data/ext/libxml/ruby_xml_dtd.c +261 -268
- data/ext/libxml/ruby_xml_encoding.c +262 -260
- data/ext/libxml/ruby_xml_encoding.h +19 -19
- data/ext/libxml/ruby_xml_html_parser_context.c +337 -338
- data/ext/libxml/ruby_xml_input_cbg.c +191 -191
- data/ext/libxml/ruby_xml_io.c +52 -50
- data/ext/libxml/ruby_xml_namespace.c +2 -2
- data/ext/libxml/ruby_xml_node.c +1446 -1452
- data/ext/libxml/ruby_xml_parser_context.c +999 -1001
- data/ext/libxml/ruby_xml_reader.c +1226 -1228
- data/ext/libxml/ruby_xml_relaxng.c +110 -111
- data/ext/libxml/ruby_xml_sax2_handler.c +326 -328
- data/ext/libxml/ruby_xml_schema.c +300 -301
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/libxml/ruby_xml_writer.c +34 -16
- data/ext/libxml/ruby_xml_xpath.c +188 -187
- data/ext/libxml/ruby_xml_xpath_context.c +360 -361
- data/ext/libxml/ruby_xml_xpath_object.c +335 -335
- data/libxml-ruby.gemspec +47 -44
- data/test/tc_attr.rb +5 -7
- data/test/tc_attr_decl.rb +5 -6
- data/test/tc_attributes.rb +1 -2
- data/test/tc_canonicalize.rb +1 -2
- data/test/tc_deprecated_require.rb +1 -2
- data/test/tc_document.rb +4 -5
- data/test/tc_document_write.rb +2 -3
- data/test/tc_dtd.rb +4 -5
- data/test/tc_encoding.rb +126 -126
- data/test/tc_encoding_sax.rb +4 -3
- data/test/tc_error.rb +14 -15
- data/test/tc_html_parser.rb +15 -7
- data/test/tc_html_parser_context.rb +1 -2
- data/test/tc_namespace.rb +2 -3
- data/test/tc_namespaces.rb +5 -6
- data/test/tc_node.rb +2 -3
- data/test/tc_node_cdata.rb +2 -3
- data/test/tc_node_comment.rb +1 -2
- data/test/tc_node_copy.rb +1 -2
- data/test/tc_node_edit.rb +5 -7
- data/test/tc_node_pi.rb +1 -2
- data/test/tc_node_text.rb +2 -3
- data/test/tc_node_write.rb +2 -3
- data/test/tc_node_xlink.rb +1 -2
- data/test/tc_parser.rb +18 -24
- data/test/tc_parser_context.rb +6 -7
- data/test/tc_properties.rb +1 -2
- data/test/tc_reader.rb +9 -10
- data/test/tc_relaxng.rb +4 -5
- data/test/tc_sax_parser.rb +9 -10
- data/test/tc_schema.rb +4 -5
- data/test/tc_traversal.rb +1 -2
- data/test/tc_writer.rb +1 -2
- data/test/tc_xinclude.rb +1 -2
- data/test/tc_xml.rb +1 -2
- data/test/tc_xpath.rb +8 -9
- data/test/tc_xpath_context.rb +3 -4
- data/test/tc_xpath_expression.rb +3 -4
- data/test/tc_xpointer.rb +1 -3
- data/test/test_helper.rb +3 -1
- data/test/test_suite.rb +0 -1
- metadata +90 -72
- data/test/etc_doc_to_s.rb +0 -21
- data/test/ets_doc_file.rb +0 -17
- data/test/ets_doc_to_s.rb +0 -23
- data/test/ets_gpx.rb +0 -28
- data/test/ets_node_gc.rb +0 -23
- data/test/ets_test.xml +0 -2
- data/test/ets_tsr.rb +0 -11
- data/test/model/kml_sample.xml +0 -915
- data/test/remove_test.rb +0 -9
- data/test/tc_gc.rb +0 -86
- data/test/tc_parser.rb.orig +0 -384
data/ext/libxml/ruby_xml_cbg.c
CHANGED
@@ -1,85 +1,85 @@
|
|
1
|
-
#include "ruby_libxml.h"
|
2
|
-
#include <string.h>
|
3
|
-
#include <libxml/xmlIO.h>
|
4
|
-
|
5
|
-
/*
|
6
|
-
int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
7
|
-
xmlInputOpenCallback openFunc,
|
8
|
-
xmlInputReadCallback readFunc,
|
9
|
-
xmlInputCloseCallback closeFunc);
|
10
|
-
|
11
|
-
|
12
|
-
int (*xmlInputMatchCallback) (char const *filename);
|
13
|
-
void* (*xmlInputOpenCallback) (char const *filename);
|
14
|
-
int (*xmlInputReadCallback) (void *context,
|
15
|
-
char *buffer,
|
16
|
-
int len);
|
17
|
-
int (*xmlInputCloseCallback) (void *context);
|
18
|
-
*/
|
19
|
-
|
20
|
-
typedef struct deb_doc_context
|
21
|
-
{
|
22
|
-
char *buffer;
|
23
|
-
char *bpos;
|
24
|
-
int remaining;
|
25
|
-
} deb_doc_context;
|
26
|
-
|
27
|
-
int deb_Match(char const *filename)
|
28
|
-
{
|
29
|
-
fprintf(stderr, "deb_Match: %s\n", filename);
|
30
|
-
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6))
|
31
|
-
{
|
32
|
-
return (1);
|
33
|
-
}
|
34
|
-
return (0);
|
35
|
-
}
|
36
|
-
|
37
|
-
void* deb_Open(char const *filename)
|
38
|
-
{
|
39
|
-
deb_doc_context *deb_doc;
|
40
|
-
VALUE res;
|
41
|
-
|
42
|
-
deb_doc = (deb_doc_context*) malloc(sizeof(deb_doc_context));
|
43
|
-
|
44
|
-
res = rb_funcall(rb_funcall(rb_mKernel, rb_intern("const_get"), 1,
|
45
|
-
rb_str_new2("DEBSystem")), rb_intern("document_query"), 1, rb_str_new2(filename));
|
46
|
-
deb_doc->buffer = strdup(StringValuePtr(res));
|
47
|
-
//deb_doc->buffer = strdup("<serepes>serepes</serepes>");
|
48
|
-
|
49
|
-
deb_doc->bpos = deb_doc->buffer;
|
50
|
-
deb_doc->remaining = strlen(deb_doc->buffer);
|
51
|
-
return deb_doc;
|
52
|
-
}
|
53
|
-
|
54
|
-
int deb_Read(void *context, char *buffer, int len)
|
55
|
-
{
|
56
|
-
deb_doc_context *deb_doc;
|
57
|
-
int ret_len;
|
58
|
-
deb_doc = (deb_doc_context*) context;
|
59
|
-
|
60
|
-
if (len >= deb_doc->remaining)
|
61
|
-
{
|
62
|
-
ret_len = deb_doc->remaining;
|
63
|
-
}
|
64
|
-
else
|
65
|
-
{
|
66
|
-
ret_len = len;
|
67
|
-
}
|
68
|
-
deb_doc->remaining -= ret_len;
|
69
|
-
strncpy(buffer, deb_doc->bpos, ret_len);
|
70
|
-
deb_doc->bpos += ret_len;
|
71
|
-
|
72
|
-
return ret_len;
|
73
|
-
}
|
74
|
-
|
75
|
-
int deb_Close(void *context)
|
76
|
-
{
|
77
|
-
free(((deb_doc_context*) context)->buffer);
|
78
|
-
free(context);
|
79
|
-
return 1;
|
80
|
-
}
|
81
|
-
|
82
|
-
void deb_register_cbg()
|
83
|
-
{
|
84
|
-
xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close);
|
85
|
-
}
|
1
|
+
#include "ruby_libxml.h"
|
2
|
+
#include <string.h>
|
3
|
+
#include <libxml/xmlIO.h>
|
4
|
+
|
5
|
+
/*
|
6
|
+
int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
7
|
+
xmlInputOpenCallback openFunc,
|
8
|
+
xmlInputReadCallback readFunc,
|
9
|
+
xmlInputCloseCallback closeFunc);
|
10
|
+
|
11
|
+
|
12
|
+
int (*xmlInputMatchCallback) (char const *filename);
|
13
|
+
void* (*xmlInputOpenCallback) (char const *filename);
|
14
|
+
int (*xmlInputReadCallback) (void *context,
|
15
|
+
char *buffer,
|
16
|
+
int len);
|
17
|
+
int (*xmlInputCloseCallback) (void *context);
|
18
|
+
*/
|
19
|
+
|
20
|
+
typedef struct deb_doc_context
|
21
|
+
{
|
22
|
+
char *buffer;
|
23
|
+
char *bpos;
|
24
|
+
int remaining;
|
25
|
+
} deb_doc_context;
|
26
|
+
|
27
|
+
int deb_Match(char const *filename)
|
28
|
+
{
|
29
|
+
fprintf(stderr, "deb_Match: %s\n", filename);
|
30
|
+
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "deb://", 6))
|
31
|
+
{
|
32
|
+
return (1);
|
33
|
+
}
|
34
|
+
return (0);
|
35
|
+
}
|
36
|
+
|
37
|
+
void* deb_Open(char const *filename)
|
38
|
+
{
|
39
|
+
deb_doc_context *deb_doc;
|
40
|
+
VALUE res;
|
41
|
+
|
42
|
+
deb_doc = (deb_doc_context*) malloc(sizeof(deb_doc_context));
|
43
|
+
|
44
|
+
res = rb_funcall(rb_funcall(rb_mKernel, rb_intern("const_get"), 1,
|
45
|
+
rb_str_new2("DEBSystem")), rb_intern("document_query"), 1, rb_str_new2(filename));
|
46
|
+
deb_doc->buffer = strdup(StringValuePtr(res));
|
47
|
+
//deb_doc->buffer = strdup("<serepes>serepes</serepes>");
|
48
|
+
|
49
|
+
deb_doc->bpos = deb_doc->buffer;
|
50
|
+
deb_doc->remaining = (int)strlen(deb_doc->buffer);
|
51
|
+
return deb_doc;
|
52
|
+
}
|
53
|
+
|
54
|
+
int deb_Read(void *context, char *buffer, int len)
|
55
|
+
{
|
56
|
+
deb_doc_context *deb_doc;
|
57
|
+
int ret_len;
|
58
|
+
deb_doc = (deb_doc_context*) context;
|
59
|
+
|
60
|
+
if (len >= deb_doc->remaining)
|
61
|
+
{
|
62
|
+
ret_len = deb_doc->remaining;
|
63
|
+
}
|
64
|
+
else
|
65
|
+
{
|
66
|
+
ret_len = len;
|
67
|
+
}
|
68
|
+
deb_doc->remaining -= ret_len;
|
69
|
+
strncpy(buffer, deb_doc->bpos, ret_len);
|
70
|
+
deb_doc->bpos += ret_len;
|
71
|
+
|
72
|
+
return ret_len;
|
73
|
+
}
|
74
|
+
|
75
|
+
int deb_Close(void *context)
|
76
|
+
{
|
77
|
+
free(((deb_doc_context*) context)->buffer);
|
78
|
+
free(context);
|
79
|
+
return 1;
|
80
|
+
}
|
81
|
+
|
82
|
+
void deb_register_cbg()
|
83
|
+
{
|
84
|
+
xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close);
|
85
|
+
}
|