nokogiri 1.11.3-x86-mingw32 → 1.12.0.rc1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/LICENSE-DEPENDENCIES.md +243 -22
- data/LICENSE.md +1 -1
- data/README.md +6 -5
- data/dependencies.yml +12 -12
- data/ext/nokogiri/depend +35 -34
- data/ext/nokogiri/extconf.rb +181 -103
- data/ext/nokogiri/gumbo.c +611 -0
- data/ext/nokogiri/{html_document.c → html4_document.c} +8 -8
- data/ext/nokogiri/{html_element_description.c → html4_element_description.c} +20 -18
- data/ext/nokogiri/{html_entity_lookup.c → html4_entity_lookup.c} +7 -7
- data/ext/nokogiri/{html_sax_parser_context.c → html4_sax_parser_context.c} +5 -5
- data/ext/nokogiri/{html_sax_push_parser.c → html4_sax_push_parser.c} +4 -4
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +6 -4
- data/ext/nokogiri/include/libxml2/libxml/parser.h +9 -7
- data/ext/nokogiri/include/libxml2/libxml/tree.h +3 -3
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +2 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +39 -115
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +1 -1
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +6 -6
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +1 -3
- data/ext/nokogiri/libxml2_backwards_compat.c +30 -30
- data/ext/nokogiri/nokogiri.c +70 -38
- data/ext/nokogiri/nokogiri.h +16 -9
- data/ext/nokogiri/xml_document.c +13 -13
- data/ext/nokogiri/xml_element_content.c +2 -0
- data/ext/nokogiri/xml_encoding_handler.c +11 -6
- data/ext/nokogiri/xml_namespace.c +2 -0
- data/ext/nokogiri/xml_node.c +118 -110
- data/ext/nokogiri/xml_node_set.c +20 -20
- data/ext/nokogiri/xml_reader.c +2 -0
- data/ext/nokogiri/xml_sax_parser.c +6 -6
- data/ext/nokogiri/xml_sax_parser_context.c +2 -0
- data/ext/nokogiri/xml_schema.c +2 -0
- data/ext/nokogiri/xml_xpath_context.c +67 -65
- data/ext/nokogiri/xslt_stylesheet.c +2 -1
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/lib/nokogiri.rb +31 -29
- data/lib/nokogiri/2.5/nokogiri.so +0 -0
- data/lib/nokogiri/2.6/nokogiri.so +0 -0
- data/lib/nokogiri/2.7/nokogiri.so +0 -0
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/css.rb +14 -14
- data/lib/nokogiri/css/parser.rb +1 -1
- data/lib/nokogiri/css/parser.y +1 -1
- data/lib/nokogiri/css/syntax_error.rb +1 -1
- data/lib/nokogiri/extension.rb +2 -2
- data/lib/nokogiri/gumbo.rb +14 -0
- data/lib/nokogiri/html.rb +31 -27
- data/lib/nokogiri/html4.rb +40 -0
- data/lib/nokogiri/{html → html4}/builder.rb +2 -2
- data/lib/nokogiri/{html → html4}/document.rb +4 -4
- data/lib/nokogiri/{html → html4}/document_fragment.rb +3 -3
- data/lib/nokogiri/{html → html4}/element_description.rb +1 -1
- data/lib/nokogiri/{html → html4}/element_description_defaults.rb +1 -1
- data/lib/nokogiri/{html → html4}/entity_lookup.rb +1 -1
- data/lib/nokogiri/{html → html4}/sax/parser.rb +11 -14
- data/lib/nokogiri/html4/sax/parser_context.rb +19 -0
- data/lib/nokogiri/{html → html4}/sax/push_parser.rb +5 -5
- data/lib/nokogiri/html5.rb +473 -0
- data/lib/nokogiri/html5/document.rb +74 -0
- data/lib/nokogiri/html5/document_fragment.rb +80 -0
- data/lib/nokogiri/html5/node.rb +93 -0
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/version/info.rb +12 -2
- data/lib/nokogiri/xml.rb +35 -36
- data/lib/nokogiri/xml/node.rb +6 -5
- data/lib/nokogiri/xml/parse_options.rb +2 -0
- data/lib/nokogiri/xml/pp.rb +2 -2
- data/lib/nokogiri/xml/sax.rb +4 -4
- data/lib/nokogiri/xml/sax/document.rb +24 -30
- data/lib/nokogiri/xml/xpath.rb +2 -2
- data/lib/nokogiri/xslt.rb +16 -16
- data/lib/nokogiri/xslt/stylesheet.rb +1 -1
- metadata +37 -37
- data/lib/nokogiri/html/sax/parser_context.rb +0 -17
@@ -122,7 +122,7 @@ typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
|
|
122
122
|
* @line: returned line information
|
123
123
|
*
|
124
124
|
* A schemas validation locator, a callback called by the validator.
|
125
|
-
* This is used when file or node
|
125
|
+
* This is used when file or node information are not available
|
126
126
|
* to find out what file and line number are affected
|
127
127
|
*
|
128
128
|
* Returns: 0 in case of success and -1 in case of error
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
|
-
* Summary: compile-time version
|
3
|
-
* Description: compile-time version
|
2
|
+
* Summary: compile-time version information
|
3
|
+
* Description: compile-time version information for the XML library
|
4
4
|
*
|
5
5
|
* Copy: See Copyright for the status of this software.
|
6
6
|
*
|
@@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
29
29
|
*
|
30
30
|
* the version string like "1.2.3"
|
31
31
|
*/
|
32
|
-
#define LIBXML_DOTTED_VERSION "2.9.
|
32
|
+
#define LIBXML_DOTTED_VERSION "2.9.12"
|
33
33
|
|
34
34
|
/**
|
35
35
|
* LIBXML_VERSION:
|
36
36
|
*
|
37
37
|
* the version number: 1.2.3 value is 10203
|
38
38
|
*/
|
39
|
-
#define LIBXML_VERSION
|
39
|
+
#define LIBXML_VERSION 20912
|
40
40
|
|
41
41
|
/**
|
42
42
|
* LIBXML_VERSION_STRING:
|
43
43
|
*
|
44
44
|
* the version number string, 1.2.3 value is "10203"
|
45
45
|
*/
|
46
|
-
#define LIBXML_VERSION_STRING "
|
46
|
+
#define LIBXML_VERSION_STRING "20912"
|
47
47
|
|
48
48
|
/**
|
49
49
|
* LIBXML_VERSION_EXTRA:
|
@@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|
58
58
|
* Macro to check that the libxml version in use is compatible with
|
59
59
|
* the version the software has been compiled against
|
60
60
|
*/
|
61
|
-
#define LIBXML_TEST_VERSION xmlCheckVersion(
|
61
|
+
#define LIBXML_TEST_VERSION xmlCheckVersion(20912);
|
62
62
|
|
63
63
|
#ifndef VMS
|
64
64
|
#if 0
|
@@ -359,8 +359,6 @@ struct _xmlXPathContext {
|
|
359
359
|
unsigned long opLimit;
|
360
360
|
unsigned long opCount;
|
361
361
|
int depth;
|
362
|
-
int maxDepth;
|
363
|
-
int maxParserDepth;
|
364
362
|
};
|
365
363
|
|
366
364
|
/*
|
@@ -373,7 +371,7 @@ typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
|
|
373
371
|
/**
|
374
372
|
* xmlXPathParserContext:
|
375
373
|
*
|
376
|
-
* An XPath parser context. It contains pure parsing
|
374
|
+
* An XPath parser context. It contains pure parsing information,
|
377
375
|
* an xmlXPathContext, and the stack of objects.
|
378
376
|
*/
|
379
377
|
struct _xmlXPathParserContext {
|
@@ -20,14 +20,14 @@ xmlFirstElementChild(xmlNodePtr parent)
|
|
20
20
|
return (NULL);
|
21
21
|
}
|
22
22
|
switch (parent->type) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
case XML_ELEMENT_NODE:
|
24
|
+
case XML_ENTITY_NODE:
|
25
|
+
case XML_DOCUMENT_NODE:
|
26
|
+
case XML_HTML_DOCUMENT_NODE:
|
27
|
+
cur = parent->children;
|
28
|
+
break;
|
29
|
+
default:
|
30
|
+
return (NULL);
|
31
31
|
}
|
32
32
|
while (cur != NULL) {
|
33
33
|
if (cur->type == XML_ELEMENT_NODE) {
|
@@ -57,20 +57,20 @@ xmlNextElementSibling(xmlNodePtr node)
|
|
57
57
|
return (NULL);
|
58
58
|
}
|
59
59
|
switch (node->type) {
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
60
|
+
case XML_ELEMENT_NODE:
|
61
|
+
case XML_TEXT_NODE:
|
62
|
+
case XML_CDATA_SECTION_NODE:
|
63
|
+
case XML_ENTITY_REF_NODE:
|
64
|
+
case XML_ENTITY_NODE:
|
65
|
+
case XML_PI_NODE:
|
66
|
+
case XML_COMMENT_NODE:
|
67
|
+
case XML_DTD_NODE:
|
68
|
+
case XML_XINCLUDE_START:
|
69
|
+
case XML_XINCLUDE_END:
|
70
|
+
node = node->next;
|
71
|
+
break;
|
72
|
+
default:
|
73
|
+
return (NULL);
|
74
74
|
}
|
75
75
|
while (node != NULL) {
|
76
76
|
if (node->type == XML_ELEMENT_NODE) {
|
@@ -101,14 +101,14 @@ xmlLastElementChild(xmlNodePtr parent)
|
|
101
101
|
return (NULL);
|
102
102
|
}
|
103
103
|
switch (parent->type) {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
104
|
+
case XML_ELEMENT_NODE:
|
105
|
+
case XML_ENTITY_NODE:
|
106
|
+
case XML_DOCUMENT_NODE:
|
107
|
+
case XML_HTML_DOCUMENT_NODE:
|
108
|
+
cur = parent->last;
|
109
|
+
break;
|
110
|
+
default:
|
111
|
+
return (NULL);
|
112
112
|
}
|
113
113
|
while (cur != NULL) {
|
114
114
|
if (cur->type == XML_ELEMENT_NODE) {
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#include <nokogiri.h>
|
2
2
|
|
3
3
|
VALUE mNokogiri ;
|
4
|
-
VALUE
|
5
|
-
VALUE
|
4
|
+
VALUE mNokogiriGumbo ;
|
5
|
+
VALUE mNokogiriHtml4 ;
|
6
|
+
VALUE mNokogiriHtml4Sax ;
|
7
|
+
VALUE mNokogiriHtml5 ;
|
6
8
|
VALUE mNokogiriXml ;
|
7
9
|
VALUE mNokogiriXmlSax ;
|
8
10
|
VALUE mNokogiriXmlXpath ;
|
@@ -13,38 +15,39 @@ VALUE cNokogiriXmlCharacterData;
|
|
13
15
|
VALUE cNokogiriXmlElement;
|
14
16
|
VALUE cNokogiriXmlXpathSyntaxError;
|
15
17
|
|
16
|
-
void noko_init_xml_attr();
|
17
|
-
void noko_init_xml_attribute_decl();
|
18
|
-
void noko_init_xml_cdata();
|
19
|
-
void noko_init_xml_comment();
|
20
|
-
void noko_init_xml_document();
|
21
|
-
void noko_init_xml_document_fragment();
|
22
|
-
void noko_init_xml_dtd();
|
23
|
-
void noko_init_xml_element_content();
|
24
|
-
void noko_init_xml_element_decl();
|
25
|
-
void noko_init_xml_encoding_handler();
|
26
|
-
void noko_init_xml_entity_decl();
|
27
|
-
void noko_init_xml_entity_reference();
|
28
|
-
void noko_init_xml_namespace();
|
29
|
-
void noko_init_xml_node();
|
30
|
-
void noko_init_xml_node_set();
|
31
|
-
void noko_init_xml_processing_instruction();
|
32
|
-
void noko_init_xml_reader();
|
33
|
-
void noko_init_xml_relax_ng();
|
34
|
-
void noko_init_xml_sax_parser();
|
35
|
-
void noko_init_xml_sax_parser_context();
|
36
|
-
void noko_init_xml_sax_push_parser();
|
37
|
-
void noko_init_xml_schema();
|
38
|
-
void noko_init_xml_syntax_error();
|
39
|
-
void noko_init_xml_text();
|
40
|
-
void noko_init_xml_xpath_context();
|
41
|
-
void noko_init_xslt_stylesheet();
|
42
|
-
void noko_init_html_document();
|
43
|
-
void noko_init_html_element_description();
|
44
|
-
void noko_init_html_entity_lookup();
|
45
|
-
void noko_init_html_sax_parser_context();
|
46
|
-
void noko_init_html_sax_push_parser();
|
47
|
-
void
|
18
|
+
void noko_init_xml_attr(void);
|
19
|
+
void noko_init_xml_attribute_decl(void);
|
20
|
+
void noko_init_xml_cdata(void);
|
21
|
+
void noko_init_xml_comment(void);
|
22
|
+
void noko_init_xml_document(void);
|
23
|
+
void noko_init_xml_document_fragment(void);
|
24
|
+
void noko_init_xml_dtd(void);
|
25
|
+
void noko_init_xml_element_content(void);
|
26
|
+
void noko_init_xml_element_decl(void);
|
27
|
+
void noko_init_xml_encoding_handler(void);
|
28
|
+
void noko_init_xml_entity_decl(void);
|
29
|
+
void noko_init_xml_entity_reference(void);
|
30
|
+
void noko_init_xml_namespace(void);
|
31
|
+
void noko_init_xml_node(void);
|
32
|
+
void noko_init_xml_node_set(void);
|
33
|
+
void noko_init_xml_processing_instruction(void);
|
34
|
+
void noko_init_xml_reader(void);
|
35
|
+
void noko_init_xml_relax_ng(void);
|
36
|
+
void noko_init_xml_sax_parser(void);
|
37
|
+
void noko_init_xml_sax_parser_context(void);
|
38
|
+
void noko_init_xml_sax_push_parser(void);
|
39
|
+
void noko_init_xml_schema(void);
|
40
|
+
void noko_init_xml_syntax_error(void);
|
41
|
+
void noko_init_xml_text(void);
|
42
|
+
void noko_init_xml_xpath_context(void);
|
43
|
+
void noko_init_xslt_stylesheet(void);
|
44
|
+
void noko_init_html_document(void);
|
45
|
+
void noko_init_html_element_description(void);
|
46
|
+
void noko_init_html_entity_lookup(void);
|
47
|
+
void noko_init_html_sax_parser_context(void);
|
48
|
+
void noko_init_html_sax_push_parser(void);
|
49
|
+
void noko_init_gumbo(void);
|
50
|
+
void noko_init_test_global_handlers(void);
|
48
51
|
|
49
52
|
static ID id_read, id_write;
|
50
53
|
|
@@ -152,12 +155,14 @@ void
|
|
152
155
|
Init_nokogiri()
|
153
156
|
{
|
154
157
|
mNokogiri = rb_define_module("Nokogiri");
|
158
|
+
mNokogiriGumbo = rb_define_module_under(mNokogiri, "Gumbo");
|
159
|
+
mNokogiriHtml4 = rb_define_module_under(mNokogiri, "HTML4");
|
160
|
+
mNokogiriHtml4Sax = rb_define_module_under(mNokogiriHtml4, "SAX");
|
161
|
+
mNokogiriHtml5 = rb_define_module_under(mNokogiri, "HTML5");
|
155
162
|
mNokogiriXml = rb_define_module_under(mNokogiri, "XML");
|
156
|
-
mNokogiriHtml = rb_define_module_under(mNokogiri, "HTML");
|
157
|
-
mNokogiriXslt = rb_define_module_under(mNokogiri, "XSLT");
|
158
|
-
mNokogiriXmlXpath = rb_define_module_under(mNokogiriXml, "XPath");
|
159
163
|
mNokogiriXmlSax = rb_define_module_under(mNokogiriXml, "SAX");
|
160
|
-
|
164
|
+
mNokogiriXmlXpath = rb_define_module_under(mNokogiriXml, "XPath");
|
165
|
+
mNokogiriXslt = rb_define_module_under(mNokogiri, "XSLT");
|
161
166
|
|
162
167
|
rb_const_set(mNokogiri, rb_intern("LIBXML_COMPILED_VERSION"), NOKOGIRI_STR_NEW2(LIBXML_DOTTED_VERSION));
|
163
168
|
rb_const_set(mNokogiri, rb_intern("LIBXML_LOADED_VERSION"), NOKOGIRI_STR_NEW2(xmlParserVersion));
|
@@ -191,9 +196,35 @@ Init_nokogiri()
|
|
191
196
|
rb_const_set(mNokogiri, rb_intern("OTHER_LIBRARY_VERSIONS"), NOKOGIRI_STR_NEW2(NOKOGIRI_OTHER_LIBRARY_VERSIONS));
|
192
197
|
#endif
|
193
198
|
|
199
|
+
#if defined(_WIN32) && !defined(NOKOGIRI_PACKAGED_LIBRARIES)
|
200
|
+
/*
|
201
|
+
* We choose *not* to do use Ruby's memory management functions with windows DLLs because of this
|
202
|
+
* issue in libxml 2.9.12:
|
203
|
+
*
|
204
|
+
* https://github.com/sparklemotion/nokogiri/issues/2241
|
205
|
+
*
|
206
|
+
* If the atexit() issue gets fixed in a future version of libxml2, then we may be able to skip
|
207
|
+
* this config only for the specific libxml2 versions 2.9.12.
|
208
|
+
*
|
209
|
+
* Alternatively, now that Ruby has a generational GC, it might be OK to let libxml2 use its
|
210
|
+
* default memory management functions (recall that this config was introduced to reduce memory
|
211
|
+
* bloat and allow Ruby to GC more often); but we should *really* test with production workloads
|
212
|
+
* before making that kind of a potentially-invasive change.
|
213
|
+
*/
|
214
|
+
rb_const_set(mNokogiri, rb_intern("LIBXML_MEMORY_MANAGEMENT"), NOKOGIRI_STR_NEW2("default"));
|
215
|
+
#else
|
216
|
+
rb_const_set(mNokogiri, rb_intern("LIBXML_MEMORY_MANAGEMENT"), NOKOGIRI_STR_NEW2("ruby"));
|
194
217
|
xmlMemSetup((xmlFreeFunc)ruby_xfree, (xmlMallocFunc)ruby_xmalloc, (xmlReallocFunc)ruby_xrealloc, ruby_strdup);
|
218
|
+
#endif
|
195
219
|
|
196
220
|
xmlInitParser();
|
221
|
+
exsltRegisterAll();
|
222
|
+
|
223
|
+
if (xsltExtModuleFunctionLookup((xmlChar*)"date-time", EXSLT_DATE_NAMESPACE)) {
|
224
|
+
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qtrue);
|
225
|
+
} else {
|
226
|
+
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qfalse);
|
227
|
+
}
|
197
228
|
|
198
229
|
cNokogiriSyntaxError = rb_define_class_under(mNokogiri, "SyntaxError", rb_eStandardError);
|
199
230
|
noko_init_xml_syntax_error();
|
@@ -238,6 +269,7 @@ Init_nokogiri()
|
|
238
269
|
noko_init_xml_document_fragment();
|
239
270
|
noko_init_xml_document();
|
240
271
|
noko_init_html_document();
|
272
|
+
noko_init_gumbo();
|
241
273
|
|
242
274
|
noko_init_test_global_handlers();
|
243
275
|
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#ifndef NOKOGIRI_NATIVE
|
2
2
|
#define NOKOGIRI_NATIVE
|
3
3
|
|
4
|
-
#
|
4
|
+
#ifdef _MSC_VER
|
5
5
|
# ifndef WIN32_LEAN_AND_MEAN
|
6
6
|
# define WIN32_LEAN_AND_MEAN
|
7
7
|
# endif /* WIN32_LEAN_AND_MEAN */
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# include <windows.h>
|
16
16
|
#endif
|
17
17
|
|
18
|
-
#
|
18
|
+
#ifdef _WIN32
|
19
19
|
# define NOKOPUBFUN __declspec(dllexport)
|
20
20
|
# define NOKOPUBVAR __declspec(dllexport) extern
|
21
21
|
#else
|
@@ -69,6 +69,7 @@ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
|
|
69
69
|
#include <ruby/st.h>
|
70
70
|
#include <ruby/encoding.h>
|
71
71
|
#include <ruby/util.h>
|
72
|
+
#include <ruby/version.h>
|
72
73
|
|
73
74
|
#define NOKOGIRI_STR_NEW2(str) NOKOGIRI_STR_NEW(str, strlen((const char *)(str)))
|
74
75
|
#define NOKOGIRI_STR_NEW(str, len) rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
|
@@ -92,12 +93,16 @@ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
|
|
92
93
|
|
93
94
|
|
94
95
|
NOKOPUBVAR VALUE mNokogiri ;
|
95
|
-
NOKOPUBVAR VALUE
|
96
|
-
NOKOPUBVAR VALUE
|
96
|
+
NOKOPUBVAR VALUE mNokogiriGumbo ;
|
97
|
+
NOKOPUBVAR VALUE mNokogiriHtml4 ;
|
98
|
+
NOKOPUBVAR VALUE mNokogiriHtml4Sax ;
|
99
|
+
NOKOPUBVAR VALUE mNokogiriHtml5 ;
|
97
100
|
NOKOPUBVAR VALUE mNokogiriXml ;
|
98
101
|
NOKOPUBVAR VALUE mNokogiriXmlSax ;
|
102
|
+
NOKOPUBVAR VALUE mNokogiriXmlXpath ;
|
99
103
|
NOKOPUBVAR VALUE mNokogiriXslt ;
|
100
104
|
|
105
|
+
NOKOPUBVAR VALUE cNokogiriEncodingHandler;
|
101
106
|
NOKOPUBVAR VALUE cNokogiriSyntaxError;
|
102
107
|
NOKOPUBVAR VALUE cNokogiriXmlAttr;
|
103
108
|
NOKOPUBVAR VALUE cNokogiriXmlAttributeDecl;
|
@@ -128,10 +133,11 @@ NOKOPUBVAR VALUE cNokogiriXmlXpathContext;
|
|
128
133
|
NOKOPUBVAR VALUE cNokogiriXmlXpathSyntaxError;
|
129
134
|
NOKOPUBVAR VALUE cNokogiriXsltStylesheet ;
|
130
135
|
|
131
|
-
NOKOPUBVAR VALUE
|
132
|
-
NOKOPUBVAR VALUE
|
133
|
-
NOKOPUBVAR VALUE
|
134
|
-
NOKOPUBVAR VALUE
|
136
|
+
NOKOPUBVAR VALUE cNokogiriHtml4Document ;
|
137
|
+
NOKOPUBVAR VALUE cNokogiriHtml4SaxPushParser ;
|
138
|
+
NOKOPUBVAR VALUE cNokogiriHtml4ElementDescription ;
|
139
|
+
NOKOPUBVAR VALUE cNokogiriHtml4SaxParserContext;
|
140
|
+
NOKOPUBVAR VALUE cNokogiriHtml5Document ;
|
135
141
|
|
136
142
|
typedef struct _nokogiriTuple {
|
137
143
|
VALUE doc;
|
@@ -177,7 +183,8 @@ VALUE noko_xml_node_set_wrap(xmlNodeSetPtr node_set, VALUE document) ;
|
|
177
183
|
|
178
184
|
VALUE noko_xml_document_wrap_with_init_args(VALUE klass, xmlDocPtr doc, int argc, VALUE *argv);
|
179
185
|
VALUE noko_xml_document_wrap(VALUE klass, xmlDocPtr doc);
|
180
|
-
NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
|
186
|
+
NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
|
187
|
+
xmlDocPtr doc); /* deprecated. use noko_xml_document_wrap() instead. */
|
181
188
|
|
182
189
|
#define DOC_RUBY_OBJECT_TEST(x) ((nokogiriTuplePtr)(x->_private))
|
183
190
|
#define DOC_RUBY_OBJECT(x) (((nokogiriTuplePtr)(x->_private))->doc)
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -6,19 +6,19 @@ static int
|
|
6
6
|
dealloc_node_i2(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
|
7
7
|
{
|
8
8
|
switch (node->type) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
case XML_ATTRIBUTE_NODE:
|
10
|
+
xmlFreePropList((xmlAttrPtr)node);
|
11
|
+
break;
|
12
|
+
case XML_NAMESPACE_DECL:
|
13
|
+
xmlFreeNs((xmlNsPtr)node);
|
14
|
+
break;
|
15
|
+
case XML_DTD_NODE:
|
16
|
+
xmlFreeDtd((xmlDtdPtr)node);
|
17
|
+
break;
|
18
|
+
default:
|
19
|
+
if (node->parent == NULL) {
|
20
|
+
xmlAddChild((xmlNodePtr)doc, node);
|
21
|
+
}
|
22
22
|
}
|
23
23
|
return ST_CONTINUE;
|
24
24
|
}
|
@@ -116,6 +116,8 @@ noko_init_xml_element_content()
|
|
116
116
|
{
|
117
117
|
cNokogiriXmlElementContent = rb_define_class_under(mNokogiriXml, "ElementContent", rb_cObject);
|
118
118
|
|
119
|
+
rb_undef_alloc_func(cNokogiriXmlElementContent);
|
120
|
+
|
119
121
|
rb_define_method(cNokogiriXmlElementContent, "name", get_name, 0);
|
120
122
|
rb_define_method(cNokogiriXmlElementContent, "type", get_type, 0);
|
121
123
|
rb_define_method(cNokogiriXmlElementContent, "occur", get_occur, 0);
|
@@ -1,5 +1,8 @@
|
|
1
1
|
#include <nokogiri.h>
|
2
2
|
|
3
|
+
VALUE cNokogiriEncodingHandler;
|
4
|
+
|
5
|
+
|
3
6
|
/*
|
4
7
|
* call-seq: Nokogiri::EncodingHandler.[](name)
|
5
8
|
*
|
@@ -75,11 +78,13 @@ name(VALUE self)
|
|
75
78
|
void
|
76
79
|
noko_init_xml_encoding_handler()
|
77
80
|
{
|
78
|
-
|
81
|
+
cNokogiriEncodingHandler = rb_define_class_under(mNokogiri, "EncodingHandler", rb_cObject);
|
82
|
+
|
83
|
+
rb_undef_alloc_func(cNokogiriEncodingHandler);
|
79
84
|
|
80
|
-
rb_define_singleton_method(
|
81
|
-
rb_define_singleton_method(
|
82
|
-
rb_define_singleton_method(
|
83
|
-
rb_define_singleton_method(
|
84
|
-
rb_define_method(
|
85
|
+
rb_define_singleton_method(cNokogiriEncodingHandler, "[]", get, 1);
|
86
|
+
rb_define_singleton_method(cNokogiriEncodingHandler, "delete", delete, 1);
|
87
|
+
rb_define_singleton_method(cNokogiriEncodingHandler, "alias", alias, 2);
|
88
|
+
rb_define_singleton_method(cNokogiriEncodingHandler, "clear_aliases!", clear_aliases, 0);
|
89
|
+
rb_define_method(cNokogiriEncodingHandler, "name", name, 0);
|
85
90
|
}
|
@@ -113,6 +113,8 @@ noko_init_xml_namespace()
|
|
113
113
|
{
|
114
114
|
cNokogiriXmlNamespace = rb_define_class_under(mNokogiriXml, "Namespace", rb_cObject);
|
115
115
|
|
116
|
+
rb_undef_alloc_func(cNokogiriXmlNamespace);
|
117
|
+
|
116
118
|
rb_define_method(cNokogiriXmlNamespace, "prefix", prefix, 0);
|
117
119
|
rb_define_method(cNokogiriXmlNamespace, "href", href, 0);
|
118
120
|
}
|