libxml-ruby 5.0.5 → 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 +7 -0
- data/Rakefile +98 -98
- data/ext/libxml/extconf.h +1 -0
- data/ext/libxml/libxml.c +79 -79
- 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_cbg.c +85 -85
- data/ext/libxml/ruby_xml_dtd.h +9 -9
- 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.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.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.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_context.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.h +10 -10
- 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 +2 -2
- 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-ruby.rb +2 -2
- data/test/test_error.rb +5 -2
- data/test/test_helper.rb +1 -0
- data/test/test_writer.rb +500 -468
- metadata +3 -4
- 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
|
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
|
+
}
|
data/ext/libxml/ruby_xml_dtd.h
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#ifndef __RXML_DTD__
|
|
2
|
-
#define __RXML_DTD__
|
|
3
|
-
|
|
4
|
-
extern VALUE cXMLDtd;
|
|
5
|
-
|
|
6
|
-
void rxml_init_dtd(void);
|
|
7
|
-
VALUE rxml_dtd_wrap(xmlDtdPtr xdtd);
|
|
8
|
-
|
|
9
|
-
#endif
|
|
1
|
+
#ifndef __RXML_DTD__
|
|
2
|
+
#define __RXML_DTD__
|
|
3
|
+
|
|
4
|
+
extern VALUE cXMLDtd;
|
|
5
|
+
|
|
6
|
+
void rxml_init_dtd(void);
|
|
7
|
+
VALUE rxml_dtd_wrap(xmlDtdPtr xdtd);
|
|
8
|
+
|
|
9
|
+
#endif
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#include "ruby_libxml.h"
|
|
4
|
-
|
|
5
|
-
#include <libxml/HTMLparser.h>
|
|
6
|
-
|
|
7
|
-
/* Document-class: LibXML::XML::HTMLParser
|
|
8
|
-
*
|
|
9
|
-
* The HTML parser implements an HTML 4.0 non-verifying parser with an API
|
|
10
|
-
* compatible with the XML::Parser. In contrast with the XML::Parser,
|
|
11
|
-
* it can parse "real world" HTML, even if it severely broken from a
|
|
12
|
-
* specification point of view.
|
|
13
|
-
*
|
|
14
|
-
* The HTML parser creates an in-memory document object
|
|
15
|
-
* that consist of any number of XML::Node instances. This is simple
|
|
16
|
-
* and powerful model, but has the major limitation that the size of
|
|
17
|
-
* the document that can be processed is limited by the amount of
|
|
18
|
-
* memory available.
|
|
19
|
-
*
|
|
20
|
-
* Using the html parser is simple:
|
|
21
|
-
*
|
|
22
|
-
* parser = XML::HTMLParser.file('my_file')
|
|
23
|
-
* doc = parser.parse
|
|
24
|
-
*
|
|
25
|
-
* You can also parse documents (see XML::HTMLParser.document),
|
|
26
|
-
* strings (see XML::HTMLParser.string) and io objects (see
|
|
27
|
-
* XML::HTMLParser.io).
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
VALUE cXMLHtmlParser;
|
|
31
|
-
static ID CONTEXT_ATTR;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* call-seq:
|
|
35
|
-
* XML::HTMLParser.initialize -> parser
|
|
36
|
-
*
|
|
37
|
-
* Initializes a new parser instance with no pre-determined source.
|
|
38
|
-
*/
|
|
39
|
-
static VALUE rxml_html_parser_initialize(int argc, VALUE *argv, VALUE self)
|
|
40
|
-
{
|
|
41
|
-
VALUE context = Qnil;
|
|
42
|
-
|
|
43
|
-
rb_scan_args(argc, argv, "01", &context);
|
|
44
|
-
|
|
45
|
-
if (context == Qnil)
|
|
46
|
-
{
|
|
47
|
-
rb_raise(rb_eArgError, "An instance of a XML::Parser::Context must be passed to XML::HTMLParser.new");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
rb_ivar_set(self, CONTEXT_ATTR, context);
|
|
51
|
-
return self;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/*
|
|
55
|
-
* call-seq:
|
|
56
|
-
* parser.parse -> XML::Document
|
|
57
|
-
*
|
|
58
|
-
* Parse the input XML and create an XML::Document with
|
|
59
|
-
* it's content. If an error occurs, XML::Parser::ParseError
|
|
60
|
-
* is thrown.
|
|
61
|
-
*/
|
|
62
|
-
static VALUE rxml_html_parser_parse(VALUE self)
|
|
63
|
-
{
|
|
64
|
-
xmlParserCtxtPtr ctxt;
|
|
65
|
-
VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
|
|
66
|
-
|
|
67
|
-
Data_Get_Struct(context, xmlParserCtxt, ctxt);
|
|
68
|
-
|
|
69
|
-
if (htmlParseDocument(ctxt) == -1 && ! ctxt->recovery)
|
|
70
|
-
{
|
|
71
|
-
rxml_raise(&ctxt->lastError);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
rb_funcall(context, rb_intern("close"), 0);
|
|
75
|
-
|
|
76
|
-
return rxml_document_wrap(ctxt->myDoc);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
void rxml_init_html_parser(void)
|
|
80
|
-
{
|
|
81
|
-
CONTEXT_ATTR = rb_intern("@context");
|
|
82
|
-
|
|
83
|
-
cXMLHtmlParser = rb_define_class_under(mXML, "HTMLParser", rb_cObject);
|
|
84
|
-
|
|
85
|
-
/* Atributes */
|
|
86
|
-
rb_define_attr(cXMLHtmlParser, "input", 1, 0);
|
|
87
|
-
|
|
88
|
-
/* Instance methods */
|
|
89
|
-
rb_define_method(cXMLHtmlParser, "initialize", rxml_html_parser_initialize, -1);
|
|
90
|
-
rb_define_method(cXMLHtmlParser, "parse", rxml_html_parser_parse, 0);
|
|
91
|
-
}
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#include "ruby_libxml.h"
|
|
4
|
+
|
|
5
|
+
#include <libxml/HTMLparser.h>
|
|
6
|
+
|
|
7
|
+
/* Document-class: LibXML::XML::HTMLParser
|
|
8
|
+
*
|
|
9
|
+
* The HTML parser implements an HTML 4.0 non-verifying parser with an API
|
|
10
|
+
* compatible with the XML::Parser. In contrast with the XML::Parser,
|
|
11
|
+
* it can parse "real world" HTML, even if it severely broken from a
|
|
12
|
+
* specification point of view.
|
|
13
|
+
*
|
|
14
|
+
* The HTML parser creates an in-memory document object
|
|
15
|
+
* that consist of any number of XML::Node instances. This is simple
|
|
16
|
+
* and powerful model, but has the major limitation that the size of
|
|
17
|
+
* the document that can be processed is limited by the amount of
|
|
18
|
+
* memory available.
|
|
19
|
+
*
|
|
20
|
+
* Using the html parser is simple:
|
|
21
|
+
*
|
|
22
|
+
* parser = XML::HTMLParser.file('my_file')
|
|
23
|
+
* doc = parser.parse
|
|
24
|
+
*
|
|
25
|
+
* You can also parse documents (see XML::HTMLParser.document),
|
|
26
|
+
* strings (see XML::HTMLParser.string) and io objects (see
|
|
27
|
+
* XML::HTMLParser.io).
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
VALUE cXMLHtmlParser;
|
|
31
|
+
static ID CONTEXT_ATTR;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/* call-seq:
|
|
35
|
+
* XML::HTMLParser.initialize -> parser
|
|
36
|
+
*
|
|
37
|
+
* Initializes a new parser instance with no pre-determined source.
|
|
38
|
+
*/
|
|
39
|
+
static VALUE rxml_html_parser_initialize(int argc, VALUE *argv, VALUE self)
|
|
40
|
+
{
|
|
41
|
+
VALUE context = Qnil;
|
|
42
|
+
|
|
43
|
+
rb_scan_args(argc, argv, "01", &context);
|
|
44
|
+
|
|
45
|
+
if (context == Qnil)
|
|
46
|
+
{
|
|
47
|
+
rb_raise(rb_eArgError, "An instance of a XML::Parser::Context must be passed to XML::HTMLParser.new");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
rb_ivar_set(self, CONTEXT_ATTR, context);
|
|
51
|
+
return self;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* call-seq:
|
|
56
|
+
* parser.parse -> XML::Document
|
|
57
|
+
*
|
|
58
|
+
* Parse the input XML and create an XML::Document with
|
|
59
|
+
* it's content. If an error occurs, XML::Parser::ParseError
|
|
60
|
+
* is thrown.
|
|
61
|
+
*/
|
|
62
|
+
static VALUE rxml_html_parser_parse(VALUE self)
|
|
63
|
+
{
|
|
64
|
+
xmlParserCtxtPtr ctxt;
|
|
65
|
+
VALUE context = rb_ivar_get(self, CONTEXT_ATTR);
|
|
66
|
+
|
|
67
|
+
Data_Get_Struct(context, xmlParserCtxt, ctxt);
|
|
68
|
+
|
|
69
|
+
if (htmlParseDocument(ctxt) == -1 && ! ctxt->recovery)
|
|
70
|
+
{
|
|
71
|
+
rxml_raise(&ctxt->lastError);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
rb_funcall(context, rb_intern("close"), 0);
|
|
75
|
+
|
|
76
|
+
return rxml_document_wrap(ctxt->myDoc);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void rxml_init_html_parser(void)
|
|
80
|
+
{
|
|
81
|
+
CONTEXT_ATTR = rb_intern("@context");
|
|
82
|
+
|
|
83
|
+
cXMLHtmlParser = rb_define_class_under(mXML, "HTMLParser", rb_cObject);
|
|
84
|
+
|
|
85
|
+
/* Atributes */
|
|
86
|
+
rb_define_attr(cXMLHtmlParser, "input", 1, 0);
|
|
87
|
+
|
|
88
|
+
/* Instance methods */
|
|
89
|
+
rb_define_method(cXMLHtmlParser, "initialize", rxml_html_parser_initialize, -1);
|
|
90
|
+
rb_define_method(cXMLHtmlParser, "parse", rxml_html_parser_parse, 0);
|
|
91
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#ifndef __RXML_HTML_PARSER__
|
|
4
|
-
#define __RXML_HTML_PARSER__
|
|
5
|
-
|
|
6
|
-
extern VALUE cXMLHtmlParser;
|
|
7
|
-
|
|
8
|
-
void rxml_init_html_parser(void);
|
|
9
|
-
|
|
10
|
-
#endif
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#ifndef __RXML_HTML_PARSER__
|
|
4
|
+
#define __RXML_HTML_PARSER__
|
|
5
|
+
|
|
6
|
+
extern VALUE cXMLHtmlParser;
|
|
7
|
+
|
|
8
|
+
void rxml_init_html_parser(void);
|
|
9
|
+
|
|
10
|
+
#endif
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#ifndef __RXML_HTML_PARSER_CONTEXT__
|
|
4
|
-
#define __RXML_HTML_PARSER_CONTEXT__
|
|
5
|
-
|
|
6
|
-
extern VALUE cXMLHtmlParserContext;
|
|
7
|
-
|
|
8
|
-
void rxml_init_html_parser_context(void);
|
|
9
|
-
|
|
10
|
-
#endif
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#ifndef __RXML_HTML_PARSER_CONTEXT__
|
|
4
|
+
#define __RXML_HTML_PARSER_CONTEXT__
|
|
5
|
+
|
|
6
|
+
extern VALUE cXMLHtmlParserContext;
|
|
7
|
+
|
|
8
|
+
void rxml_init_html_parser_context(void);
|
|
9
|
+
|
|
10
|
+
#endif
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#include "ruby_libxml.h"
|
|
4
|
-
|
|
5
|
-
#include <libxml/HTMLparser.h>
|
|
6
|
-
|
|
7
|
-
/* Document-class: LibXML::XML::HTMLParser::Options
|
|
8
|
-
*
|
|
9
|
-
* Options to control the operation of the HTMLParser. The easiest
|
|
10
|
-
* way to set a parser's options is via the methods
|
|
11
|
-
* XML::HTMLParser.file, XML::HTMLParser.io or XML::HTMLParser.string.
|
|
12
|
-
* For additional control, see XML::HTMLParser::Context#options=.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
VALUE mXMLHtmlParserOptions;
|
|
16
|
-
|
|
17
|
-
void rxml_init_html_parser_options(void)
|
|
18
|
-
{
|
|
19
|
-
mXMLHtmlParserOptions = rb_define_module_under(cXMLHtmlParser, "Options");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
#if LIBXML_VERSION >= 20621
|
|
23
|
-
/* 1: Relax parsing. */
|
|
24
|
-
rb_define_const(mXMLHtmlParserOptions, "RECOVER", INT2NUM(HTML_PARSE_RECOVER));
|
|
25
|
-
#endif
|
|
26
|
-
#if LIBXML_VERSION >= 20708
|
|
27
|
-
/* 2: Do not default a doctype if not found */
|
|
28
|
-
rb_define_const(mXMLHtmlParserOptions, "NODEFDTD", INT2NUM(HTML_PARSE_NODEFDTD));
|
|
29
|
-
#endif
|
|
30
|
-
/* 32: Suppress error reports. */
|
|
31
|
-
rb_define_const(mXMLHtmlParserOptions, "NOERROR", INT2NUM(HTML_PARSE_NOERROR));
|
|
32
|
-
/* 64: Suppress warning reports. */
|
|
33
|
-
rb_define_const(mXMLHtmlParserOptions, "NOWARNING", INT2NUM(HTML_PARSE_NOWARNING));
|
|
34
|
-
/* 128: Enable pedantic error reporting. */
|
|
35
|
-
rb_define_const(mXMLHtmlParserOptions, "PEDANTIC", INT2NUM(HTML_PARSE_PEDANTIC));
|
|
36
|
-
/* 256: Remove blank nodes. */
|
|
37
|
-
rb_define_const(mXMLHtmlParserOptions, "NOBLANKS", INT2NUM(HTML_PARSE_NOBLANKS));
|
|
38
|
-
#if LIBXML_VERSION >= 20621
|
|
39
|
-
/* 2048: Forbid network access. */
|
|
40
|
-
rb_define_const(mXMLHtmlParserOptions, "NONET", INT2NUM(HTML_PARSE_NONET));
|
|
41
|
-
/* 65536: Compact small text nodes. */
|
|
42
|
-
rb_define_const(mXMLHtmlParserOptions, "COMPACT", INT2NUM(HTML_PARSE_COMPACT));
|
|
43
|
-
#endif
|
|
44
|
-
#if LIBXML_VERSION >= 20707
|
|
45
|
-
/* 8192: Do not add implied html/body... elements */
|
|
46
|
-
rb_define_const(mXMLHtmlParserOptions, "NOIMPLIED", INT2NUM(HTML_PARSE_NOIMPLIED));
|
|
47
|
-
#endif
|
|
48
|
-
}
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#include "ruby_libxml.h"
|
|
4
|
+
|
|
5
|
+
#include <libxml/HTMLparser.h>
|
|
6
|
+
|
|
7
|
+
/* Document-class: LibXML::XML::HTMLParser::Options
|
|
8
|
+
*
|
|
9
|
+
* Options to control the operation of the HTMLParser. The easiest
|
|
10
|
+
* way to set a parser's options is via the methods
|
|
11
|
+
* XML::HTMLParser.file, XML::HTMLParser.io or XML::HTMLParser.string.
|
|
12
|
+
* For additional control, see XML::HTMLParser::Context#options=.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
VALUE mXMLHtmlParserOptions;
|
|
16
|
+
|
|
17
|
+
void rxml_init_html_parser_options(void)
|
|
18
|
+
{
|
|
19
|
+
mXMLHtmlParserOptions = rb_define_module_under(cXMLHtmlParser, "Options");
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
#if LIBXML_VERSION >= 20621
|
|
23
|
+
/* 1: Relax parsing. */
|
|
24
|
+
rb_define_const(mXMLHtmlParserOptions, "RECOVER", INT2NUM(HTML_PARSE_RECOVER));
|
|
25
|
+
#endif
|
|
26
|
+
#if LIBXML_VERSION >= 20708
|
|
27
|
+
/* 2: Do not default a doctype if not found */
|
|
28
|
+
rb_define_const(mXMLHtmlParserOptions, "NODEFDTD", INT2NUM(HTML_PARSE_NODEFDTD));
|
|
29
|
+
#endif
|
|
30
|
+
/* 32: Suppress error reports. */
|
|
31
|
+
rb_define_const(mXMLHtmlParserOptions, "NOERROR", INT2NUM(HTML_PARSE_NOERROR));
|
|
32
|
+
/* 64: Suppress warning reports. */
|
|
33
|
+
rb_define_const(mXMLHtmlParserOptions, "NOWARNING", INT2NUM(HTML_PARSE_NOWARNING));
|
|
34
|
+
/* 128: Enable pedantic error reporting. */
|
|
35
|
+
rb_define_const(mXMLHtmlParserOptions, "PEDANTIC", INT2NUM(HTML_PARSE_PEDANTIC));
|
|
36
|
+
/* 256: Remove blank nodes. */
|
|
37
|
+
rb_define_const(mXMLHtmlParserOptions, "NOBLANKS", INT2NUM(HTML_PARSE_NOBLANKS));
|
|
38
|
+
#if LIBXML_VERSION >= 20621
|
|
39
|
+
/* 2048: Forbid network access. */
|
|
40
|
+
rb_define_const(mXMLHtmlParserOptions, "NONET", INT2NUM(HTML_PARSE_NONET));
|
|
41
|
+
/* 65536: Compact small text nodes. */
|
|
42
|
+
rb_define_const(mXMLHtmlParserOptions, "COMPACT", INT2NUM(HTML_PARSE_COMPACT));
|
|
43
|
+
#endif
|
|
44
|
+
#if LIBXML_VERSION >= 20707
|
|
45
|
+
/* 8192: Do not add implied html/body... elements */
|
|
46
|
+
rb_define_const(mXMLHtmlParserOptions, "NOIMPLIED", INT2NUM(HTML_PARSE_NOIMPLIED));
|
|
47
|
+
#endif
|
|
48
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
-
|
|
3
|
-
#ifndef __RXML_HTML_PARSER_OPTIONS__
|
|
4
|
-
#define __RXML_HTML_PARSER_OPTIONS__
|
|
5
|
-
|
|
6
|
-
extern VALUE mXMLHtmlParserOptions;
|
|
7
|
-
|
|
8
|
-
void rxml_init_html_parser_options(void);
|
|
9
|
-
|
|
10
|
-
#endif
|
|
1
|
+
/* Please see the LICENSE file for copyright and distribution information */
|
|
2
|
+
|
|
3
|
+
#ifndef __RXML_HTML_PARSER_OPTIONS__
|
|
4
|
+
#define __RXML_HTML_PARSER_OPTIONS__
|
|
5
|
+
|
|
6
|
+
extern VALUE mXMLHtmlParserOptions;
|
|
7
|
+
|
|
8
|
+
void rxml_init_html_parser_options(void);
|
|
9
|
+
|
|
10
|
+
#endif
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#ifndef _INPUT_CBG_
|
|
2
|
-
#define _INPUT_CBG_
|
|
3
|
-
|
|
4
|
-
void rxml_init_input_callbacks(void);
|
|
5
|
-
|
|
6
|
-
typedef struct ic_doc_context {
|
|
7
|
-
char *buffer;
|
|
8
|
-
char *bpos;
|
|
9
|
-
int remaining;
|
|
10
|
-
} ic_doc_context;
|
|
11
|
-
|
|
12
|
-
typedef struct ic_scheme {
|
|
13
|
-
char *scheme_name;
|
|
14
|
-
VALUE class;
|
|
15
|
-
int name_len;
|
|
16
|
-
|
|
17
|
-
struct ic_scheme *next_scheme;
|
|
18
|
-
} ic_scheme;
|
|
19
|
-
|
|
20
|
-
#endif
|
|
1
|
+
#ifndef _INPUT_CBG_
|
|
2
|
+
#define _INPUT_CBG_
|
|
3
|
+
|
|
4
|
+
void rxml_init_input_callbacks(void);
|
|
5
|
+
|
|
6
|
+
typedef struct ic_doc_context {
|
|
7
|
+
char *buffer;
|
|
8
|
+
char *bpos;
|
|
9
|
+
int remaining;
|
|
10
|
+
} ic_doc_context;
|
|
11
|
+
|
|
12
|
+
typedef struct ic_scheme {
|
|
13
|
+
char *scheme_name;
|
|
14
|
+
VALUE class;
|
|
15
|
+
int name_len;
|
|
16
|
+
|
|
17
|
+
struct ic_scheme *next_scheme;
|
|
18
|
+
} ic_scheme;
|
|
19
|
+
|
|
20
|
+
#endif
|