libxml-ruby 5.0.4 → 5.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY +17 -6
- data/README.rdoc +1 -1
- data/Rakefile +98 -98
- data/ext/libxml/extconf.h +1 -0
- data/ext/libxml/extconf.rb +5 -0
- data/ext/libxml/libxml.c +79 -79
- data/ext/libxml/ruby_xml.c +556 -556
- data/ext/libxml/ruby_xml_attr.c +333 -333
- data/ext/libxml/ruby_xml_attr.h +12 -12
- data/ext/libxml/ruby_xml_attr_decl.h +11 -11
- data/ext/libxml/ruby_xml_attributes.h +17 -17
- data/ext/libxml/ruby_xml_cbg.c +85 -85
- data/ext/libxml/ruby_xml_document.c +1129 -1129
- data/ext/libxml/ruby_xml_dtd.c +257 -257
- data/ext/libxml/ruby_xml_dtd.h +9 -9
- data/ext/libxml/ruby_xml_encoding.c +250 -250
- data/ext/libxml/ruby_xml_error.c +1003 -1003
- data/ext/libxml/ruby_xml_error.h +14 -14
- data/ext/libxml/ruby_xml_html_parser.c +91 -91
- data/ext/libxml/ruby_xml_html_parser.h +10 -10
- data/ext/libxml/ruby_xml_html_parser_context.c +351 -351
- data/ext/libxml/ruby_xml_html_parser_context.h +10 -10
- data/ext/libxml/ruby_xml_html_parser_options.c +48 -48
- data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
- data/ext/libxml/ruby_xml_input_cbg.c +188 -188
- data/ext/libxml/ruby_xml_input_cbg.h +20 -20
- data/ext/libxml/ruby_xml_io.c +47 -47
- data/ext/libxml/ruby_xml_io.h +10 -10
- data/ext/libxml/ruby_xml_namespace.c +151 -151
- data/ext/libxml/ruby_xml_namespace.h +10 -10
- data/ext/libxml/ruby_xml_namespaces.c +293 -293
- data/ext/libxml/ruby_xml_namespaces.h +9 -9
- data/ext/libxml/ruby_xml_node.h +13 -13
- data/ext/libxml/ruby_xml_parser.c +91 -91
- data/ext/libxml/ruby_xml_parser.h +10 -10
- data/ext/libxml/ruby_xml_parser_context.c +1009 -1009
- data/ext/libxml/ruby_xml_parser_context.h +10 -10
- data/ext/libxml/ruby_xml_parser_options.c +74 -74
- data/ext/libxml/ruby_xml_parser_options.h +10 -10
- data/ext/libxml/ruby_xml_reader.h +14 -14
- data/ext/libxml/ruby_xml_relaxng.h +8 -8
- data/ext/libxml/ruby_xml_sax2_handler.c +326 -326
- data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
- data/ext/libxml/ruby_xml_sax_parser.c +108 -108
- data/ext/libxml/ruby_xml_sax_parser.h +10 -10
- data/ext/libxml/ruby_xml_schema.h +25 -25
- data/ext/libxml/ruby_xml_schema_attribute.h +37 -37
- data/ext/libxml/ruby_xml_schema_element.h +11 -11
- data/ext/libxml/ruby_xml_schema_facet.c +50 -50
- data/ext/libxml/ruby_xml_schema_facet.h +9 -9
- data/ext/libxml/ruby_xml_schema_type.h +9 -9
- data/ext/libxml/ruby_xml_version.h +9 -9
- data/ext/libxml/ruby_xml_writer.c +1124 -1124
- data/ext/libxml/ruby_xml_writer.h +6 -6
- data/ext/libxml/ruby_xml_xinclude.c +20 -20
- data/ext/libxml/ruby_xml_xinclude.h +11 -11
- data/ext/libxml/ruby_xml_xpath.c +195 -195
- data/ext/libxml/ruby_xml_xpath.h +15 -15
- data/ext/libxml/ruby_xml_xpath_context.c +362 -362
- data/ext/libxml/ruby_xml_xpath_context.h +9 -9
- data/ext/libxml/ruby_xml_xpath_expression.h +10 -10
- data/ext/libxml/ruby_xml_xpath_object.h +17 -17
- data/lib/libxml/attr.rb +122 -122
- data/lib/libxml/attr_decl.rb +80 -80
- data/lib/libxml/attributes.rb +13 -13
- data/lib/libxml/document.rb +194 -194
- data/lib/libxml/error.rb +95 -95
- data/lib/libxml/hpricot.rb +77 -77
- data/lib/libxml/html_parser.rb +96 -96
- data/lib/libxml/namespace.rb +61 -61
- data/lib/libxml/namespaces.rb +37 -37
- data/lib/libxml/node.rb +323 -323
- data/lib/libxml/parser.rb +102 -102
- data/lib/libxml/sax_callbacks.rb +179 -179
- data/lib/libxml/sax_parser.rb +40 -40
- data/lib/libxml/tree.rb +28 -28
- data/lib/libxml-ruby.rb +2 -2
- data/lib/libxml.rb +4 -4
- data/lib/xml/libxml.rb +10 -10
- data/lib/xml.rb +13 -13
- data/libxml-ruby.gemspec +50 -49
- data/test/test_document.rb +140 -140
- data/test/test_document_write.rb +142 -142
- data/test/test_dtd.rb +126 -126
- data/test/test_encoding.rb +126 -126
- data/test/test_error.rb +197 -194
- data/test/test_helper.rb +21 -20
- data/test/test_namespace.rb +58 -58
- data/test/test_node.rb +235 -235
- data/test/test_node_write.rb +93 -93
- data/test/test_parser.rb +333 -333
- data/test/test_reader.rb +364 -364
- data/test/test_writer.rb +500 -468
- data/test/test_xml.rb +168 -168
- metadata +5 -5
- data/test/test.rb +0 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#ifndef __RXML_ATTR_DECL__
|
|
4
|
-
#define __RXML_ATTR_DECL__
|
|
5
|
-
|
|
6
|
-
extern VALUE cXMLAttrDecl;
|
|
7
|
-
|
|
8
|
-
void rxml_init_attr_decl(void);
|
|
9
|
-
VALUE rxml_attr_decl_wrap(xmlAttributePtr xattribute);
|
|
10
|
-
VALUE rxml_attr_decl_value_get(VALUE self);
|
|
11
|
-
#endif
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#ifndef __RXML_ATTR_DECL__
|
|
4
|
+
#define __RXML_ATTR_DECL__
|
|
5
|
+
|
|
6
|
+
extern VALUE cXMLAttrDecl;
|
|
7
|
+
|
|
8
|
+
void rxml_init_attr_decl(void);
|
|
9
|
+
VALUE rxml_attr_decl_wrap(xmlAttributePtr xattribute);
|
|
10
|
+
VALUE rxml_attr_decl_value_get(VALUE self);
|
|
11
|
+
#endif
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#ifndef __RXML_ATTRIBUTES__
|
|
4
|
-
#define __RXML_ATTRIBUTES__
|
|
5
|
-
|
|
6
|
-
#include <libxml/tree.h>
|
|
7
|
-
|
|
8
|
-
extern VALUE cXMLAttributesibutes;
|
|
9
|
-
|
|
10
|
-
void rxml_init_attributes(void);
|
|
11
|
-
VALUE rxml_attributes_new(xmlNodePtr xnode);
|
|
12
|
-
|
|
13
|
-
VALUE rxml_attributes_attribute_get(VALUE self, VALUE name);
|
|
14
|
-
VALUE rxml_attributes_attribute_set(VALUE self, VALUE name, VALUE value);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
#endif
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#ifndef __RXML_ATTRIBUTES__
|
|
4
|
+
#define __RXML_ATTRIBUTES__
|
|
5
|
+
|
|
6
|
+
#include <libxml/tree.h>
|
|
7
|
+
|
|
8
|
+
extern VALUE cXMLAttributesibutes;
|
|
9
|
+
|
|
10
|
+
void rxml_init_attributes(void);
|
|
11
|
+
VALUE rxml_attributes_new(xmlNodePtr xnode);
|
|
12
|
+
|
|
13
|
+
VALUE rxml_attributes_attribute_get(VALUE self, VALUE name);
|
|
14
|
+
VALUE rxml_attributes_attribute_set(VALUE self, VALUE name, VALUE value);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#endif
|
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 = (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(void)
|
|
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(void)
|
|
83
|
+
{
|
|
84
|
+
xmlRegisterInputCallbacks(deb_Match, deb_Open, deb_Read, deb_Close);
|
|
85
|
+
}
|