nokogiri 1.11.0.rc3-x86-mingw32 → 1.11.3-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.

Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/LICENSE-DEPENDENCIES.md +1015 -947
  4. data/LICENSE.md +1 -1
  5. data/README.md +168 -91
  6. data/ext/nokogiri/depend +37 -358
  7. data/ext/nokogiri/extconf.rb +581 -374
  8. data/ext/nokogiri/html_document.c +78 -82
  9. data/ext/nokogiri/html_element_description.c +84 -71
  10. data/ext/nokogiri/html_entity_lookup.c +21 -16
  11. data/ext/nokogiri/html_sax_parser_context.c +69 -66
  12. data/ext/nokogiri/html_sax_push_parser.c +42 -34
  13. data/ext/nokogiri/include/libexslt/exslt.h +102 -0
  14. data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
  15. data/ext/nokogiri/include/libexslt/exsltexports.h +140 -0
  16. data/ext/nokogiri/include/libxml2/libxml/DOCBparser.h +96 -0
  17. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
  18. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
  19. data/ext/nokogiri/include/libxml2/libxml/SAX.h +173 -0
  20. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +178 -0
  21. data/ext/nokogiri/include/libxml2/libxml/c14n.h +126 -0
  22. data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
  23. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
  24. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
  25. data/ext/nokogiri/include/libxml2/libxml/dict.h +79 -0
  26. data/ext/nokogiri/include/libxml2/libxml/encoding.h +245 -0
  27. data/ext/nokogiri/include/libxml2/libxml/entities.h +151 -0
  28. data/ext/nokogiri/include/libxml2/libxml/globals.h +508 -0
  29. data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
  30. data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
  31. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +163 -0
  32. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
  33. data/ext/nokogiri/include/libxml2/libxml/parser.h +1241 -0
  34. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +644 -0
  35. data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
  36. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +217 -0
  37. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
  38. data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
  39. data/ext/nokogiri/include/libxml2/libxml/threads.h +89 -0
  40. data/ext/nokogiri/include/libxml2/libxml/tree.h +1311 -0
  41. data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
  42. data/ext/nokogiri/include/libxml2/libxml/valid.h +458 -0
  43. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
  44. data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
  45. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +366 -0
  46. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
  47. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +945 -0
  48. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +153 -0
  49. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +224 -0
  50. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
  51. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
  52. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
  53. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
  54. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
  55. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +151 -0
  56. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
  57. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
  58. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +485 -0
  59. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
  60. data/ext/nokogiri/include/libxml2/libxml/xpath.h +566 -0
  61. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
  62. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +114 -0
  63. data/ext/nokogiri/include/libxslt/attributes.h +38 -0
  64. data/ext/nokogiri/include/libxslt/documents.h +93 -0
  65. data/ext/nokogiri/include/libxslt/extensions.h +262 -0
  66. data/ext/nokogiri/include/libxslt/extra.h +72 -0
  67. data/ext/nokogiri/include/libxslt/functions.h +78 -0
  68. data/ext/nokogiri/include/libxslt/imports.h +75 -0
  69. data/ext/nokogiri/include/libxslt/keys.h +53 -0
  70. data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
  71. data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
  72. data/ext/nokogiri/include/libxslt/pattern.h +84 -0
  73. data/ext/nokogiri/include/libxslt/preproc.h +43 -0
  74. data/ext/nokogiri/include/libxslt/security.h +104 -0
  75. data/ext/nokogiri/include/libxslt/templates.h +77 -0
  76. data/ext/nokogiri/include/libxslt/transform.h +207 -0
  77. data/ext/nokogiri/include/libxslt/variables.h +118 -0
  78. data/ext/nokogiri/include/libxslt/xslt.h +110 -0
  79. data/ext/nokogiri/include/libxslt/xsltInternals.h +1978 -0
  80. data/ext/nokogiri/include/libxslt/xsltconfig.h +180 -0
  81. data/ext/nokogiri/include/libxslt/xsltexports.h +142 -0
  82. data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
  83. data/ext/nokogiri/include/libxslt/xsltutils.h +313 -0
  84. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  85. data/ext/nokogiri/nokogiri.c +192 -93
  86. data/ext/nokogiri/nokogiri.h +177 -98
  87. data/ext/nokogiri/test_global_handlers.c +40 -0
  88. data/ext/nokogiri/xml_attr.c +15 -15
  89. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  90. data/ext/nokogiri/xml_cdata.c +13 -18
  91. data/ext/nokogiri/xml_comment.c +19 -26
  92. data/ext/nokogiri/xml_document.c +246 -188
  93. data/ext/nokogiri/xml_document_fragment.c +13 -15
  94. data/ext/nokogiri/xml_dtd.c +54 -48
  95. data/ext/nokogiri/xml_element_content.c +30 -27
  96. data/ext/nokogiri/xml_element_decl.c +22 -22
  97. data/ext/nokogiri/xml_encoding_handler.c +17 -11
  98. data/ext/nokogiri/xml_entity_decl.c +32 -30
  99. data/ext/nokogiri/xml_entity_reference.c +16 -18
  100. data/ext/nokogiri/xml_namespace.c +56 -49
  101. data/ext/nokogiri/xml_node.c +371 -320
  102. data/ext/nokogiri/xml_node_set.c +168 -156
  103. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  104. data/ext/nokogiri/xml_reader.c +191 -157
  105. data/ext/nokogiri/xml_relax_ng.c +52 -28
  106. data/ext/nokogiri/xml_sax_parser.c +118 -118
  107. data/ext/nokogiri/xml_sax_parser_context.c +103 -86
  108. data/ext/nokogiri/xml_sax_push_parser.c +36 -27
  109. data/ext/nokogiri/xml_schema.c +95 -47
  110. data/ext/nokogiri/xml_syntax_error.c +42 -21
  111. data/ext/nokogiri/xml_text.c +13 -17
  112. data/ext/nokogiri/xml_xpath_context.c +206 -123
  113. data/ext/nokogiri/xslt_stylesheet.c +158 -161
  114. data/lib/nokogiri.rb +3 -7
  115. data/lib/nokogiri/2.5/nokogiri.so +0 -0
  116. data/lib/nokogiri/2.6/nokogiri.so +0 -0
  117. data/lib/nokogiri/2.7/nokogiri.so +0 -0
  118. data/lib/nokogiri/3.0/nokogiri.so +0 -0
  119. data/lib/nokogiri/css/parser.rb +3 -3
  120. data/lib/nokogiri/css/parser.y +2 -2
  121. data/lib/nokogiri/css/xpath_visitor.rb +70 -42
  122. data/lib/nokogiri/extension.rb +26 -0
  123. data/lib/nokogiri/html/document.rb +12 -26
  124. data/lib/nokogiri/html/document_fragment.rb +15 -15
  125. data/lib/nokogiri/version.rb +2 -149
  126. data/lib/nokogiri/version/constant.rb +5 -0
  127. data/lib/nokogiri/version/info.rb +205 -0
  128. data/lib/nokogiri/xml/document.rb +91 -35
  129. data/lib/nokogiri/xml/document_fragment.rb +4 -6
  130. data/lib/nokogiri/xml/node.rb +89 -69
  131. data/lib/nokogiri/xml/parse_options.rb +6 -0
  132. data/lib/nokogiri/xml/reader.rb +2 -9
  133. data/lib/nokogiri/xml/relax_ng.rb +6 -2
  134. data/lib/nokogiri/xml/schema.rb +12 -4
  135. data/lib/nokogiri/xml/searchable.rb +3 -1
  136. data/lib/nokogiri/xml/xpath.rb +1 -3
  137. data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -1
  138. metadata +150 -171
  139. data/ext/nokogiri/html_document.h +0 -10
  140. data/ext/nokogiri/html_element_description.h +0 -10
  141. data/ext/nokogiri/html_entity_lookup.h +0 -8
  142. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  143. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  144. data/ext/nokogiri/xml_attr.h +0 -9
  145. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  146. data/ext/nokogiri/xml_cdata.h +0 -9
  147. data/ext/nokogiri/xml_comment.h +0 -9
  148. data/ext/nokogiri/xml_document.h +0 -23
  149. data/ext/nokogiri/xml_document_fragment.h +0 -10
  150. data/ext/nokogiri/xml_dtd.h +0 -10
  151. data/ext/nokogiri/xml_element_content.h +0 -10
  152. data/ext/nokogiri/xml_element_decl.h +0 -9
  153. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  154. data/ext/nokogiri/xml_entity_decl.h +0 -10
  155. data/ext/nokogiri/xml_entity_reference.h +0 -9
  156. data/ext/nokogiri/xml_io.c +0 -63
  157. data/ext/nokogiri/xml_io.h +0 -11
  158. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  159. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  160. data/ext/nokogiri/xml_namespace.h +0 -14
  161. data/ext/nokogiri/xml_node.h +0 -13
  162. data/ext/nokogiri/xml_node_set.h +0 -12
  163. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  164. data/ext/nokogiri/xml_reader.h +0 -10
  165. data/ext/nokogiri/xml_relax_ng.h +0 -9
  166. data/ext/nokogiri/xml_sax_parser.h +0 -39
  167. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  168. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  169. data/ext/nokogiri/xml_schema.h +0 -9
  170. data/ext/nokogiri/xml_syntax_error.h +0 -13
  171. data/ext/nokogiri/xml_text.h +0 -9
  172. data/ext/nokogiri/xml_xpath_context.h +0 -10
  173. data/ext/nokogiri/xslt_stylesheet.h +0 -14
  174. data/lib/nokogiri/2.4/nokogiri.so +0 -0
@@ -2,37 +2,39 @@
2
2
  #define NOKOGIRI_NATIVE
3
3
 
4
4
  #if _MSC_VER
5
- #ifndef WIN32_LEAN_AND_MEAN
6
- #define WIN32_LEAN_AND_MEAN
7
- #endif /* WIN32_LEAN_AND_MEAN */
8
- #ifndef WIN32
9
- #define WIN32
10
- #endif /* WIN32 */
11
- #include <winsock2.h>
12
- #include <ws2tcpip.h>
13
- #include <windows.h>
5
+ # ifndef WIN32_LEAN_AND_MEAN
6
+ # define WIN32_LEAN_AND_MEAN
7
+ # endif /* WIN32_LEAN_AND_MEAN */
8
+
9
+ # ifndef WIN32
10
+ # define WIN32
11
+ # endif /* WIN32 */
12
+
13
+ # include <winsock2.h>
14
+ # include <ws2tcpip.h>
15
+ # include <windows.h>
16
+ #endif
17
+
18
+ #if _WIN32
19
+ # define NOKOPUBFUN __declspec(dllexport)
20
+ # define NOKOPUBVAR __declspec(dllexport) extern
21
+ #else
22
+ # define NOKOPUBFUN
23
+ # define NOKOPUBVAR extern
14
24
  #endif
15
25
 
26
+
16
27
  #include <stdlib.h>
17
28
  #include <string.h>
18
29
  #include <assert.h>
19
30
  #include <stdarg.h>
31
+ #include <stdio.h>
20
32
 
21
- #ifdef USE_INCLUDED_VASPRINTF
22
- int vasprintf (char **strp, const char *fmt, va_list ap);
23
- #else
24
-
25
- #define _GNU_SOURCE
26
- # include <stdio.h>
27
- #undef _GNU_SOURCE
28
-
29
- #endif
30
33
 
31
34
  #include <libxml/parser.h>
35
+ #include <libxml/tree.h>
32
36
  #include <libxml/entities.h>
33
- #include <libxml/parserInternals.h>
34
37
  #include <libxml/xpath.h>
35
- #include <libxml/xpathInternals.h>
36
38
  #include <libxml/xmlreader.h>
37
39
  #include <libxml/xmlsave.h>
38
40
  #include <libxml/xmlschemas.h>
@@ -40,95 +42,172 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
40
42
  #include <libxml/HTMLtree.h>
41
43
  #include <libxml/relaxng.h>
42
44
  #include <libxml/xinclude.h>
45
+ #include <libxml/c14n.h>
46
+ #include <libxml/parserInternals.h>
47
+ #include <libxml/xpathInternals.h>
48
+
43
49
  #include <libxslt/extensions.h>
44
50
  #include <libxslt/xsltconfig.h>
45
- #include <libxml/c14n.h>
46
- #include <ruby.h>
47
- #include <ruby/st.h>
48
- #include <ruby/encoding.h>
51
+ #include <libxslt/xsltutils.h>
52
+ #include <libxslt/transform.h>
53
+ #include <libxslt/xsltInternals.h>
49
54
 
50
- #ifndef NORETURN
51
- # if defined(__GNUC__)
52
- # define NORETURN(name) __attribute__((noreturn)) name
53
- # else
54
- # define NORETURN(name) name
55
- # endif
56
- #endif
55
+ #include <libexslt/exslt.h>
57
56
 
58
- #define NOKOGIRI_STR_NEW2(str) \
59
- NOKOGIRI_STR_NEW(str, strlen((const char *)(str)))
60
-
61
- #define NOKOGIRI_STR_NEW(str, len) \
62
- rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
63
-
64
- #define RBSTR_OR_QNIL(_str) \
65
- (_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
66
-
67
- #include <xml_libxml2_hacks.h>
68
-
69
- #include <xml_io.h>
70
- #include <xml_document.h>
71
- #include <html_entity_lookup.h>
72
- #include <html_document.h>
73
- #include <xml_node.h>
74
- #include <xml_text.h>
75
- #include <xml_cdata.h>
76
- #include <xml_attr.h>
77
- #include <xml_processing_instruction.h>
78
- #include <xml_entity_reference.h>
79
- #include <xml_document_fragment.h>
80
- #include <xml_comment.h>
81
- #include <xml_node_set.h>
82
- #include <xml_dtd.h>
83
- #include <xml_attribute_decl.h>
84
- #include <xml_element_decl.h>
85
- #include <xml_entity_decl.h>
86
- #include <xml_xpath_context.h>
87
- #include <xml_element_content.h>
88
- #include <xml_sax_parser_context.h>
89
- #include <xml_sax_parser.h>
90
- #include <xml_sax_push_parser.h>
91
- #include <xml_reader.h>
92
- #include <html_sax_parser_context.h>
93
- #include <html_sax_push_parser.h>
94
- #include <xslt_stylesheet.h>
95
- #include <xml_syntax_error.h>
96
- #include <xml_schema.h>
97
- #include <xml_relax_ng.h>
98
- #include <html_element_description.h>
99
- #include <xml_namespace.h>
100
- #include <xml_encoding_handler.h>
101
-
102
- extern VALUE mNokogiri ;
103
- extern VALUE mNokogiriXml ;
104
- extern VALUE mNokogiriXmlSax ;
105
- extern VALUE mNokogiriHtml ;
106
- extern VALUE mNokogiriHtmlSax ;
107
- extern VALUE mNokogiriXslt ;
108
-
109
- void nokogiri_root_node(xmlNodePtr);
110
- void nokogiri_root_nsdef(xmlNsPtr, xmlDocPtr);
57
+ /* libxml2_backwards_compat.c */
58
+ #ifndef HAVE_XMLFIRSTELEMENTCHILD
59
+ xmlNodePtr xmlFirstElementChild(xmlNodePtr parent);
60
+ xmlNodePtr xmlNextElementSibling(xmlNodePtr node);
61
+ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
62
+ #endif
111
63
 
112
- #ifdef DEBUG
64
+ #define XMLNS_PREFIX "xmlns"
65
+ #define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */
113
66
 
114
- #define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p);
115
- #define NOKOGIRI_DEBUG_END(p) if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p end\n", __FILE__, __LINE__, p);
116
67
 
117
- #else
68
+ #include <ruby.h>
69
+ #include <ruby/st.h>
70
+ #include <ruby/encoding.h>
71
+ #include <ruby/util.h>
118
72
 
119
- #define NOKOGIRI_DEBUG_START(p)
120
- #define NOKOGIRI_DEBUG_END(p)
73
+ #define NOKOGIRI_STR_NEW2(str) NOKOGIRI_STR_NEW(str, strlen((const char *)(str)))
74
+ #define NOKOGIRI_STR_NEW(str, len) rb_external_str_new_with_enc((const char *)(str), (long)(len), rb_utf8_encoding())
75
+ #define RBSTR_OR_QNIL(_str) (_str ? NOKOGIRI_STR_NEW2(_str) : Qnil)
121
76
 
77
+ #ifdef DEBUG
78
+ # define NOKOGIRI_DEBUG_START(p) if (getenv("NOKOGIRI_NO_FREE")) return ; if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p start\n", __FILE__, __LINE__, p);
79
+ # define NOKOGIRI_DEBUG_END(p) if (getenv("NOKOGIRI_DEBUG")) fprintf(stderr,"nokogiri: %s:%d %p end\n", __FILE__, __LINE__, p);
80
+ #else
81
+ # define NOKOGIRI_DEBUG_START(p)
82
+ # define NOKOGIRI_DEBUG_END(p)
122
83
  #endif
123
84
 
124
- #ifndef __builtin_expect
125
- # if defined(__GNUC__)
126
- # define __builtin_expect(expr, c) __builtin_expect((long)(expr), (long)(c))
127
- # endif
85
+ #ifndef NORETURN
86
+ # if defined(__GNUC__)
87
+ # define NORETURN(name) __attribute__((noreturn)) name
88
+ # else
89
+ # define NORETURN(name) name
90
+ # endif
128
91
  #endif
129
92
 
130
- #define XMLNS_PREFIX "xmlns"
131
- #define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */
132
- #define XMLNS_BUFFER_LEN 128
133
93
 
134
- #endif
94
+ NOKOPUBVAR VALUE mNokogiri ;
95
+ NOKOPUBVAR VALUE mNokogiriHtml ;
96
+ NOKOPUBVAR VALUE mNokogiriHtmlSax ;
97
+ NOKOPUBVAR VALUE mNokogiriXml ;
98
+ NOKOPUBVAR VALUE mNokogiriXmlSax ;
99
+ NOKOPUBVAR VALUE mNokogiriXslt ;
100
+
101
+ NOKOPUBVAR VALUE cNokogiriSyntaxError;
102
+ NOKOPUBVAR VALUE cNokogiriXmlAttr;
103
+ NOKOPUBVAR VALUE cNokogiriXmlAttributeDecl;
104
+ NOKOPUBVAR VALUE cNokogiriXmlCData;
105
+ NOKOPUBVAR VALUE cNokogiriXmlCharacterData;
106
+ NOKOPUBVAR VALUE cNokogiriXmlComment;
107
+ NOKOPUBVAR VALUE cNokogiriXmlDocument ;
108
+ NOKOPUBVAR VALUE cNokogiriXmlDocumentFragment;
109
+ NOKOPUBVAR VALUE cNokogiriXmlDtd;
110
+ NOKOPUBVAR VALUE cNokogiriXmlElement ;
111
+ NOKOPUBVAR VALUE cNokogiriXmlElementContent;
112
+ NOKOPUBVAR VALUE cNokogiriXmlElementDecl;
113
+ NOKOPUBVAR VALUE cNokogiriXmlEntityDecl;
114
+ NOKOPUBVAR VALUE cNokogiriXmlEntityReference;
115
+ NOKOPUBVAR VALUE cNokogiriXmlNamespace ;
116
+ NOKOPUBVAR VALUE cNokogiriXmlNode ;
117
+ NOKOPUBVAR VALUE cNokogiriXmlNodeSet ;
118
+ NOKOPUBVAR VALUE cNokogiriXmlProcessingInstruction;
119
+ NOKOPUBVAR VALUE cNokogiriXmlReader;
120
+ NOKOPUBVAR VALUE cNokogiriXmlRelaxNG;
121
+ NOKOPUBVAR VALUE cNokogiriXmlSaxParser ;
122
+ NOKOPUBVAR VALUE cNokogiriXmlSaxParserContext;
123
+ NOKOPUBVAR VALUE cNokogiriXmlSaxPushParser ;
124
+ NOKOPUBVAR VALUE cNokogiriXmlSchema;
125
+ NOKOPUBVAR VALUE cNokogiriXmlSyntaxError;
126
+ NOKOPUBVAR VALUE cNokogiriXmlText ;
127
+ NOKOPUBVAR VALUE cNokogiriXmlXpathContext;
128
+ NOKOPUBVAR VALUE cNokogiriXmlXpathSyntaxError;
129
+ NOKOPUBVAR VALUE cNokogiriXsltStylesheet ;
130
+
131
+ NOKOPUBVAR VALUE cNokogiriHtmlDocument ;
132
+ NOKOPUBVAR VALUE cNokogiriHtmlSaxPushParser ;
133
+ NOKOPUBVAR VALUE cNokogiriHtmlElementDescription ;
134
+ NOKOPUBVAR VALUE cNokogiriHtmlSaxParserContext;
135
+
136
+ typedef struct _nokogiriTuple {
137
+ VALUE doc;
138
+ st_table *unlinkedNodes;
139
+ VALUE node_cache;
140
+ } nokogiriTuple;
141
+ typedef nokogiriTuple *nokogiriTuplePtr;
142
+
143
+ typedef struct _nokogiriSAXTuple {
144
+ xmlParserCtxtPtr ctxt;
145
+ VALUE self;
146
+ } nokogiriSAXTuple;
147
+ typedef nokogiriSAXTuple *nokogiriSAXTuplePtr;
148
+
149
+ typedef struct _libxmlStructuredErrorHandlerState {
150
+ void *user_data;
151
+ xmlStructuredErrorFunc handler;
152
+ } libxmlStructuredErrorHandlerState ;
153
+
154
+ typedef struct _nokogiriXsltStylesheetTuple {
155
+ xsltStylesheetPtr ss;
156
+ VALUE func_instances;
157
+ } nokogiriXsltStylesheetTuple;
158
+
159
+ int vasprintf(char **strp, const char *fmt, va_list ap);
160
+ void noko_xml_document_pin_node(xmlNodePtr);
161
+ void noko_xml_document_pin_namespace(xmlNsPtr, xmlDocPtr);
162
+
163
+ int noko_io_read(void *ctx, char *buffer, int len);
164
+ int noko_io_write(void *ctx, char *buffer, int len);
165
+ int noko_io_close(void *ctx);
166
+
167
+ VALUE noko_xml_node_wrap(VALUE klass, xmlNodePtr node) ;
168
+ VALUE noko_xml_node_wrap_node_set_result(xmlNodePtr node, VALUE node_set) ;
169
+ VALUE noko_xml_node_attrs(xmlNodePtr node) ;
170
+
171
+ VALUE noko_xml_namespace_wrap(xmlNsPtr node, xmlDocPtr doc);
172
+ VALUE noko_xml_namespace_wrap_xpath_copy(xmlNsPtr node);
173
+
174
+ VALUE noko_xml_element_content_wrap(VALUE doc, xmlElementContentPtr element);
175
+
176
+ VALUE noko_xml_node_set_wrap(xmlNodeSetPtr node_set, VALUE document) ;
177
+
178
+ VALUE noko_xml_document_wrap_with_init_args(VALUE klass, xmlDocPtr doc, int argc, VALUE *argv);
179
+ VALUE noko_xml_document_wrap(VALUE klass, xmlDocPtr doc);
180
+ NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc); /* deprecated. use noko_xml_document_wrap() instead. */
181
+
182
+ #define DOC_RUBY_OBJECT_TEST(x) ((nokogiriTuplePtr)(x->_private))
183
+ #define DOC_RUBY_OBJECT(x) (((nokogiriTuplePtr)(x->_private))->doc)
184
+ #define DOC_UNLINKED_NODE_HASH(x) (((nokogiriTuplePtr)(x->_private))->unlinkedNodes)
185
+ #define DOC_NODE_CACHE(x) (((nokogiriTuplePtr)(x->_private))->node_cache)
186
+ #define NOKOGIRI_NAMESPACE_EH(node) ((node)->type == XML_NAMESPACE_DECL)
187
+
188
+ #define NOKOGIRI_SAX_SELF(_ctxt) ((nokogiriSAXTuplePtr)(_ctxt))->self
189
+ #define NOKOGIRI_SAX_CTXT(_ctxt) ((nokogiriSAXTuplePtr)(_ctxt))->ctxt
190
+ #define NOKOGIRI_SAX_TUPLE_NEW(_ctxt, _self) nokogiri_sax_tuple_new(_ctxt, _self)
191
+ #define NOKOGIRI_SAX_TUPLE_DESTROY(_tuple) free(_tuple)
192
+
193
+ void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
194
+ void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
195
+ xmlStructuredErrorFunc handler);
196
+ void Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state);
197
+ VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error);
198
+ void Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error);
199
+ NORETURN(void Nokogiri_error_raise(void *ctx, xmlErrorPtr error));
200
+ void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, int nargs, VALUE handler,
201
+ const char *function_name) ;
202
+
203
+ static inline
204
+ nokogiriSAXTuplePtr
205
+ nokogiri_sax_tuple_new(xmlParserCtxtPtr ctxt, VALUE self)
206
+ {
207
+ nokogiriSAXTuplePtr tuple = malloc(sizeof(nokogiriSAXTuple));
208
+ tuple->self = self;
209
+ tuple->ctxt = ctxt;
210
+ return tuple;
211
+ }
212
+
213
+ #endif /* NOKOGIRI_NATIVE */
@@ -0,0 +1,40 @@
1
+ #include <nokogiri.h>
2
+
3
+ static VALUE foreign_error_handler_block = Qnil;
4
+
5
+ static void
6
+ foreign_error_handler(void *user_data, xmlErrorPtr c_error)
7
+ {
8
+ rb_funcall(foreign_error_handler_block, rb_intern("call"), 0);
9
+ }
10
+
11
+ /*
12
+ * call-seq:
13
+ * __foreign_error_handler { ... } -> nil
14
+ *
15
+ * Override libxml2's global error handlers to call the block. This method thus has very little
16
+ * value except to test that Nokogiri is properly setting error handlers elsewhere in the code. See
17
+ * test/helper.rb for how this is being used.
18
+ */
19
+ static VALUE
20
+ rb_foreign_error_handler(VALUE klass)
21
+ {
22
+ rb_need_block();
23
+ foreign_error_handler_block = rb_block_proc();
24
+ xmlSetStructuredErrorFunc(NULL, foreign_error_handler);
25
+ return Qnil;
26
+ }
27
+
28
+ /*
29
+ * Document-module: Nokogiri::Test
30
+ *
31
+ * The Nokogiri::Test module should only be used for testing Nokogiri.
32
+ * Do NOT use this outside of the Nokogiri test suite.
33
+ */
34
+ void
35
+ noko_init_test_global_handlers()
36
+ {
37
+ VALUE mNokogiriTest = rb_define_module_under(mNokogiri, "Test");
38
+
39
+ rb_define_singleton_method(mNokogiriTest, "__foreign_error_handler", rb_foreign_error_handler, 0);
40
+ }
@@ -1,4 +1,6 @@
1
- #include <xml_attr.h>
1
+ #include <nokogiri.h>
2
+
3
+ VALUE cNokogiriXmlAttr;
2
4
 
3
5
  /*
4
6
  * call-seq:
@@ -7,7 +9,8 @@
7
9
  * Set the value for this Attr to +content+. Use `nil` to remove the value
8
10
  * (e.g., a HTML boolean attribute).
9
11
  */
10
- static VALUE set_value(VALUE self, VALUE content)
12
+ static VALUE
13
+ set_value(VALUE self, VALUE content)
11
14
  {
12
15
  xmlAttrPtr attr;
13
16
  xmlChar *value;
@@ -49,7 +52,8 @@ static VALUE set_value(VALUE self, VALUE content)
49
52
  *
50
53
  * Create a new Attr element on the +document+ with +name+
51
54
  */
52
- static VALUE new(int argc, VALUE *argv, VALUE klass)
55
+ static VALUE
56
+ new (int argc, VALUE *argv, VALUE klass)
53
57
  {
54
58
  xmlDocPtr xml_doc;
55
59
  VALUE document;
@@ -72,9 +76,9 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
72
76
  NULL
73
77
  );
74
78
 
75
- nokogiri_root_node((xmlNodePtr)node);
79
+ noko_xml_document_pin_node((xmlNodePtr)node);
76
80
 
77
- rb_node = Nokogiri_wrap_xml_node(klass, (xmlNodePtr)node);
81
+ rb_node = noko_xml_node_wrap(klass, (xmlNodePtr)node);
78
82
  rb_obj_call_init(rb_node, argc, argv);
79
83
 
80
84
  if (rb_block_given_p()) {
@@ -84,20 +88,16 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
84
88
  return rb_node;
85
89
  }
86
90
 
87
- VALUE cNokogiriXmlAttr;
88
- void init_xml_attr()
91
+ void
92
+ noko_init_xml_attr()
89
93
  {
90
- VALUE nokogiri = rb_define_module("Nokogiri");
91
- VALUE xml = rb_define_module_under(nokogiri, "XML");
92
- VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
93
-
94
+ assert(cNokogiriXmlNode);
94
95
  /*
95
96
  * Attr represents a Attr node in an xml document.
96
97
  */
97
- VALUE klass = rb_define_class_under(xml, "Attr", node);
98
+ cNokogiriXmlAttr = rb_define_class_under(mNokogiriXml, "Attr", cNokogiriXmlNode);
98
99
 
99
- cNokogiriXmlAttr = klass;
100
+ rb_define_singleton_method(cNokogiriXmlAttr, "new", new, -1);
100
101
 
101
- rb_define_singleton_method(klass, "new", new, -1);
102
- rb_define_method(klass, "value=", set_value, 1);
102
+ rb_define_method(cNokogiriXmlAttr, "value=", set_value, 1);
103
103
  }
@@ -1,4 +1,6 @@
1
- #include <xml_attribute_decl.h>
1
+ #include <nokogiri.h>
2
+
3
+ VALUE cNokogiriXmlAttributeDecl;
2
4
 
3
5
  /*
4
6
  * call-seq:
@@ -6,7 +8,8 @@
6
8
  *
7
9
  * The attribute_type for this AttributeDecl
8
10
  */
9
- static VALUE attribute_type(VALUE self)
11
+ static VALUE
12
+ attribute_type(VALUE self)
10
13
  {
11
14
  xmlAttributePtr node;
12
15
  Data_Get_Struct(self, xmlAttribute, node);
@@ -19,12 +22,13 @@ static VALUE attribute_type(VALUE self)
19
22
  *
20
23
  * The default value
21
24
  */
22
- static VALUE default_value(VALUE self)
25
+ static VALUE
26
+ default_value(VALUE self)
23
27
  {
24
28
  xmlAttributePtr node;
25
29
  Data_Get_Struct(self, xmlAttribute, node);
26
30
 
27
- if(node->defaultValue) return NOKOGIRI_STR_NEW2(node->defaultValue);
31
+ if (node->defaultValue) { return NOKOGIRI_STR_NEW2(node->defaultValue); }
28
32
  return Qnil;
29
33
  }
30
34
 
@@ -34,7 +38,8 @@ static VALUE default_value(VALUE self)
34
38
  *
35
39
  * An enumeration of possible values
36
40
  */
37
- static VALUE enumeration(VALUE self)
41
+ static VALUE
42
+ enumeration(VALUE self)
38
43
  {
39
44
  xmlAttributePtr node;
40
45
  xmlEnumerationPtr enm;
@@ -45,7 +50,7 @@ static VALUE enumeration(VALUE self)
45
50
  list = rb_ary_new();
46
51
  enm = node->tree;
47
52
 
48
- while(enm) {
53
+ while (enm) {
49
54
  rb_ary_push(list, NOKOGIRI_STR_NEW2(enm->name));
50
55
  enm = enm->next;
51
56
  }
@@ -53,18 +58,13 @@ static VALUE enumeration(VALUE self)
53
58
  return list;
54
59
  }
55
60
 
56
- VALUE cNokogiriXmlAttributeDecl;
57
-
58
- void init_xml_attribute_decl()
61
+ void
62
+ noko_init_xml_attribute_decl()
59
63
  {
60
- VALUE nokogiri = rb_define_module("Nokogiri");
61
- VALUE xml = rb_define_module_under(nokogiri, "XML");
62
- VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
63
- VALUE klass = rb_define_class_under(xml, "AttributeDecl", node);
64
-
65
- cNokogiriXmlAttributeDecl = klass;
64
+ assert(cNokogiriXmlNode);
65
+ cNokogiriXmlAttributeDecl = rb_define_class_under(mNokogiriXml, "AttributeDecl", cNokogiriXmlNode);
66
66
 
67
- rb_define_method(klass, "attribute_type", attribute_type, 0);
68
- rb_define_method(klass, "default", default_value, 0);
69
- rb_define_method(klass, "enumeration", enumeration, 0);
67
+ rb_define_method(cNokogiriXmlAttributeDecl, "attribute_type", attribute_type, 0);
68
+ rb_define_method(cNokogiriXmlAttributeDecl, "default", default_value, 0);
69
+ rb_define_method(cNokogiriXmlAttributeDecl, "enumeration", enumeration, 0);
70
70
  }