nokogiri 1.16.8 → 1.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -21
  3. data/LICENSE-DEPENDENCIES.md +6 -6
  4. data/README.md +8 -5
  5. data/dependencies.yml +6 -6
  6. data/ext/nokogiri/extconf.rb +188 -142
  7. data/ext/nokogiri/gumbo.c +69 -53
  8. data/ext/nokogiri/html4_document.c +10 -4
  9. data/ext/nokogiri/html4_element_description.c +18 -18
  10. data/ext/nokogiri/html4_sax_parser.c +40 -0
  11. data/ext/nokogiri/html4_sax_parser_context.c +48 -58
  12. data/ext/nokogiri/html4_sax_push_parser.c +25 -24
  13. data/ext/nokogiri/libxml2_polyfill.c +114 -0
  14. data/ext/nokogiri/nokogiri.c +9 -2
  15. data/ext/nokogiri/nokogiri.h +18 -33
  16. data/ext/nokogiri/xml_attr.c +1 -1
  17. data/ext/nokogiri/xml_cdata.c +2 -10
  18. data/ext/nokogiri/xml_comment.c +3 -8
  19. data/ext/nokogiri/xml_document.c +163 -156
  20. data/ext/nokogiri/xml_document_fragment.c +10 -25
  21. data/ext/nokogiri/xml_dtd.c +1 -1
  22. data/ext/nokogiri/xml_element_content.c +9 -9
  23. data/ext/nokogiri/xml_encoding_handler.c +4 -4
  24. data/ext/nokogiri/xml_namespace.c +6 -6
  25. data/ext/nokogiri/xml_node.c +134 -103
  26. data/ext/nokogiri/xml_node_set.c +46 -44
  27. data/ext/nokogiri/xml_reader.c +54 -58
  28. data/ext/nokogiri/xml_relax_ng.c +35 -56
  29. data/ext/nokogiri/xml_sax_parser.c +156 -88
  30. data/ext/nokogiri/xml_sax_parser_context.c +219 -131
  31. data/ext/nokogiri/xml_sax_push_parser.c +68 -49
  32. data/ext/nokogiri/xml_schema.c +50 -85
  33. data/ext/nokogiri/xml_syntax_error.c +19 -11
  34. data/ext/nokogiri/xml_text.c +2 -4
  35. data/ext/nokogiri/xml_xpath_context.c +103 -100
  36. data/ext/nokogiri/xslt_stylesheet.c +8 -8
  37. data/gumbo-parser/src/ascii.c +2 -2
  38. data/gumbo-parser/src/error.c +76 -48
  39. data/gumbo-parser/src/error.h +5 -1
  40. data/gumbo-parser/src/nokogiri_gumbo.h +11 -2
  41. data/gumbo-parser/src/parser.c +63 -25
  42. data/gumbo-parser/src/tokenizer.c +6 -6
  43. data/lib/nokogiri/class_resolver.rb +1 -1
  44. data/lib/nokogiri/css/node.rb +6 -2
  45. data/lib/nokogiri/css/parser.rb +6 -4
  46. data/lib/nokogiri/css/parser.y +2 -2
  47. data/lib/nokogiri/css/parser_extras.rb +6 -66
  48. data/lib/nokogiri/css/selector_cache.rb +38 -0
  49. data/lib/nokogiri/css/tokenizer.rb +4 -4
  50. data/lib/nokogiri/css/tokenizer.rex +9 -8
  51. data/lib/nokogiri/css/xpath_visitor.rb +43 -6
  52. data/lib/nokogiri/css.rb +86 -20
  53. data/lib/nokogiri/decorators/slop.rb +3 -5
  54. data/lib/nokogiri/encoding_handler.rb +2 -2
  55. data/lib/nokogiri/html4/document.rb +44 -23
  56. data/lib/nokogiri/html4/document_fragment.rb +124 -12
  57. data/lib/nokogiri/html4/encoding_reader.rb +1 -1
  58. data/lib/nokogiri/html4/sax/parser.rb +23 -38
  59. data/lib/nokogiri/html4/sax/parser_context.rb +4 -9
  60. data/lib/nokogiri/html4.rb +9 -14
  61. data/lib/nokogiri/html5/builder.rb +40 -0
  62. data/lib/nokogiri/html5/document.rb +61 -30
  63. data/lib/nokogiri/html5/document_fragment.rb +130 -20
  64. data/lib/nokogiri/html5/node.rb +4 -4
  65. data/lib/nokogiri/html5.rb +114 -72
  66. data/lib/nokogiri/version/constant.rb +1 -1
  67. data/lib/nokogiri/xml/builder.rb +8 -1
  68. data/lib/nokogiri/xml/document.rb +70 -26
  69. data/lib/nokogiri/xml/document_fragment.rb +84 -13
  70. data/lib/nokogiri/xml/node.rb +82 -11
  71. data/lib/nokogiri/xml/node_set.rb +9 -7
  72. data/lib/nokogiri/xml/parse_options.rb +1 -1
  73. data/lib/nokogiri/xml/pp/node.rb +6 -1
  74. data/lib/nokogiri/xml/reader.rb +46 -13
  75. data/lib/nokogiri/xml/relax_ng.rb +57 -20
  76. data/lib/nokogiri/xml/sax/document.rb +174 -83
  77. data/lib/nokogiri/xml/sax/parser.rb +115 -41
  78. data/lib/nokogiri/xml/sax/parser_context.rb +116 -8
  79. data/lib/nokogiri/xml/sax/push_parser.rb +3 -0
  80. data/lib/nokogiri/xml/sax.rb +48 -0
  81. data/lib/nokogiri/xml/schema.rb +112 -45
  82. data/lib/nokogiri/xml/searchable.rb +38 -42
  83. data/lib/nokogiri/xml/syntax_error.rb +22 -0
  84. data/lib/nokogiri/xml/xpath_context.rb +14 -3
  85. data/lib/nokogiri/xml.rb +13 -24
  86. data/lib/nokogiri/xslt.rb +3 -9
  87. data/lib/xsd/xmlparser/nokogiri.rb +3 -4
  88. data/patches/libxml2/0019-xpath-Use-separate-static-hash-table-for-standard-fu.patch +244 -0
  89. data/ports/archives/libxml2-2.13.5.tar.xz +0 -0
  90. data/ports/archives/libxslt-1.1.42.tar.xz +0 -0
  91. metadata +13 -12
  92. data/ext/nokogiri/libxml2_backwards_compat.c +0 -121
  93. data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +0 -25
  94. data/ports/archives/libxml2-2.12.9.tar.xz +0 -0
  95. data/ports/archives/libxslt-1.1.39.tar.xz +0 -0
@@ -0,0 +1,244 @@
1
+ From d3e3526111097560cf7c002613e2cb1d469b59e0 Mon Sep 17 00:00:00 2001
2
+ From: Nick Wellnhofer <wellnhofer@aevum.de>
3
+ Date: Sat, 21 Dec 2024 16:03:46 +0100
4
+ Subject: [PATCH] xpath: Use separate static hash table for standard functions
5
+
6
+ This avoids registering standard functions when creating an XPath
7
+ context.
8
+
9
+ Lookup of extension functions is a bit slower now, but ultimately, all
10
+ function lookups should be moved to the compilation phase.
11
+
12
+ (cherry picked from commit bf5fcf6e646bb51a0f6a3655a1d64bea97274867)
13
+ ---
14
+ xpath.c | 170 ++++++++++++++++++++++++++++++++------------------------
15
+ 1 file changed, 98 insertions(+), 72 deletions(-)
16
+
17
+ diff --git a/xpath.c b/xpath.c
18
+ index 485d7747..21711653 100644
19
+ --- a/xpath.c
20
+ +++ b/xpath.c
21
+ @@ -136,11 +136,48 @@
22
+
23
+ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
24
+
25
+ -/************************************************************************
26
+ - * *
27
+ - * Floating point stuff *
28
+ - * *
29
+ - ************************************************************************/
30
+ +static void
31
+ +xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
32
+ +
33
+ +static const struct {
34
+ + const char *name;
35
+ + xmlXPathFunction func;
36
+ +} xmlXPathStandardFunctions[] = {
37
+ + { "boolean", xmlXPathBooleanFunction },
38
+ + { "ceiling", xmlXPathCeilingFunction },
39
+ + { "count", xmlXPathCountFunction },
40
+ + { "concat", xmlXPathConcatFunction },
41
+ + { "contains", xmlXPathContainsFunction },
42
+ + { "id", xmlXPathIdFunction },
43
+ + { "false", xmlXPathFalseFunction },
44
+ + { "floor", xmlXPathFloorFunction },
45
+ + { "last", xmlXPathLastFunction },
46
+ + { "lang", xmlXPathLangFunction },
47
+ + { "local-name", xmlXPathLocalNameFunction },
48
+ + { "not", xmlXPathNotFunction },
49
+ + { "name", xmlXPathNameFunction },
50
+ + { "namespace-uri", xmlXPathNamespaceURIFunction },
51
+ + { "normalize-space", xmlXPathNormalizeFunction },
52
+ + { "number", xmlXPathNumberFunction },
53
+ + { "position", xmlXPathPositionFunction },
54
+ + { "round", xmlXPathRoundFunction },
55
+ + { "string", xmlXPathStringFunction },
56
+ + { "string-length", xmlXPathStringLengthFunction },
57
+ + { "starts-with", xmlXPathStartsWithFunction },
58
+ + { "substring", xmlXPathSubstringFunction },
59
+ + { "substring-before", xmlXPathSubstringBeforeFunction },
60
+ + { "substring-after", xmlXPathSubstringAfterFunction },
61
+ + { "sum", xmlXPathSumFunction },
62
+ + { "true", xmlXPathTrueFunction },
63
+ + { "translate", xmlXPathTranslateFunction }
64
+ +};
65
+ +
66
+ +#define NUM_STANDARD_FUNCTIONS \
67
+ + (sizeof(xmlXPathStandardFunctions) / sizeof(xmlXPathStandardFunctions[0]))
68
+ +
69
+ +#define SF_HASH_SIZE 64
70
+ +
71
+ +static unsigned char xmlXPathSFHash[SF_HASH_SIZE];
72
+
73
+ double xmlXPathNAN = 0.0;
74
+ double xmlXPathPINF = 0.0;
75
+ @@ -156,6 +193,18 @@ xmlXPathInit(void) {
76
+ xmlInitParser();
77
+ }
78
+
79
+ +ATTRIBUTE_NO_SANITIZE_INTEGER
80
+ +static unsigned
81
+ +xmlXPathSFComputeHash(const xmlChar *name) {
82
+ + unsigned hashValue = 5381;
83
+ + const xmlChar *ptr;
84
+ +
85
+ + for (ptr = name; *ptr; ptr++)
86
+ + hashValue = hashValue * 33 + *ptr;
87
+ +
88
+ + return(hashValue);
89
+ +}
90
+ +
91
+ /**
92
+ * xmlInitXPathInternal:
93
+ *
94
+ @@ -164,6 +213,8 @@ xmlXPathInit(void) {
95
+ ATTRIBUTE_NO_SANITIZE("float-divide-by-zero")
96
+ void
97
+ xmlInitXPathInternal(void) {
98
+ + size_t i;
99
+ +
100
+ #if defined(NAN) && defined(INFINITY)
101
+ xmlXPathNAN = NAN;
102
+ xmlXPathPINF = INFINITY;
103
+ @@ -175,8 +226,34 @@ xmlInitXPathInternal(void) {
104
+ xmlXPathPINF = 1.0 / zero;
105
+ xmlXPathNINF = -xmlXPathPINF;
106
+ #endif
107
+ +
108
+ + /*
109
+ + * Initialize hash table for standard functions
110
+ + */
111
+ +
112
+ + for (i = 0; i < SF_HASH_SIZE; i++)
113
+ + xmlXPathSFHash[i] = UCHAR_MAX;
114
+ +
115
+ + for (i = 0; i < NUM_STANDARD_FUNCTIONS; i++) {
116
+ + const char *name = xmlXPathStandardFunctions[i].name;
117
+ + int bucketIndex = xmlXPathSFComputeHash(BAD_CAST name) % SF_HASH_SIZE;
118
+ +
119
+ + while (xmlXPathSFHash[bucketIndex] != UCHAR_MAX) {
120
+ + bucketIndex += 1;
121
+ + if (bucketIndex >= SF_HASH_SIZE)
122
+ + bucketIndex = 0;
123
+ + }
124
+ +
125
+ + xmlXPathSFHash[bucketIndex] = i;
126
+ + }
127
+ }
128
+
129
+ +/************************************************************************
130
+ + * *
131
+ + * Floating point stuff *
132
+ + * *
133
+ + ************************************************************************/
134
+ +
135
+ /**
136
+ * xmlXPathIsNaN:
137
+ * @val: a double value
138
+ @@ -3979,18 +4056,6 @@ xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
139
+ */
140
+ xmlXPathFunction
141
+ xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) {
142
+ - if (ctxt == NULL)
143
+ - return (NULL);
144
+ -
145
+ - if (ctxt->funcLookupFunc != NULL) {
146
+ - xmlXPathFunction ret;
147
+ - xmlXPathFuncLookupFunc f;
148
+ -
149
+ - f = ctxt->funcLookupFunc;
150
+ - ret = f(ctxt->funcLookupData, name, NULL);
151
+ - if (ret != NULL)
152
+ - return(ret);
153
+ - }
154
+ return(xmlXPathFunctionLookupNS(ctxt, name, NULL));
155
+ }
156
+
157
+ @@ -4015,6 +4080,22 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
158
+ if (name == NULL)
159
+ return(NULL);
160
+
161
+ + if (ns_uri == NULL) {
162
+ + int bucketIndex = xmlXPathSFComputeHash(name) % SF_HASH_SIZE;
163
+ +
164
+ + while (xmlXPathSFHash[bucketIndex] != UCHAR_MAX) {
165
+ + int funcIndex = xmlXPathSFHash[bucketIndex];
166
+ +
167
+ + if (strcmp(xmlXPathStandardFunctions[funcIndex].name,
168
+ + (char *) name) == 0)
169
+ + return(xmlXPathStandardFunctions[funcIndex].func);
170
+ +
171
+ + bucketIndex += 1;
172
+ + if (bucketIndex >= SF_HASH_SIZE)
173
+ + bucketIndex = 0;
174
+ + }
175
+ + }
176
+ +
177
+ if (ctxt->funcLookupFunc != NULL) {
178
+ xmlXPathFuncLookupFunc f;
179
+
180
+ @@ -13494,61 +13575,6 @@ xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) {
181
+ void
182
+ xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt)
183
+ {
184
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"boolean",
185
+ - xmlXPathBooleanFunction);
186
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"ceiling",
187
+ - xmlXPathCeilingFunction);
188
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"count",
189
+ - xmlXPathCountFunction);
190
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"concat",
191
+ - xmlXPathConcatFunction);
192
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"contains",
193
+ - xmlXPathContainsFunction);
194
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"id",
195
+ - xmlXPathIdFunction);
196
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"false",
197
+ - xmlXPathFalseFunction);
198
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"floor",
199
+ - xmlXPathFloorFunction);
200
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"last",
201
+ - xmlXPathLastFunction);
202
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"lang",
203
+ - xmlXPathLangFunction);
204
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"local-name",
205
+ - xmlXPathLocalNameFunction);
206
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"not",
207
+ - xmlXPathNotFunction);
208
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"name",
209
+ - xmlXPathNameFunction);
210
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"namespace-uri",
211
+ - xmlXPathNamespaceURIFunction);
212
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"normalize-space",
213
+ - xmlXPathNormalizeFunction);
214
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"number",
215
+ - xmlXPathNumberFunction);
216
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"position",
217
+ - xmlXPathPositionFunction);
218
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"round",
219
+ - xmlXPathRoundFunction);
220
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string",
221
+ - xmlXPathStringFunction);
222
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string-length",
223
+ - xmlXPathStringLengthFunction);
224
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"starts-with",
225
+ - xmlXPathStartsWithFunction);
226
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring",
227
+ - xmlXPathSubstringFunction);
228
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-before",
229
+ - xmlXPathSubstringBeforeFunction);
230
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-after",
231
+ - xmlXPathSubstringAfterFunction);
232
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"sum",
233
+ - xmlXPathSumFunction);
234
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"true",
235
+ - xmlXPathTrueFunction);
236
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"translate",
237
+ - xmlXPathTranslateFunction);
238
+ -
239
+ xmlXPathRegisterFuncNS(ctxt, (const xmlChar *)"escape-uri",
240
+ (const xmlChar *)"http://www.w3.org/2002/08/xquery-functions",
241
+ xmlXPathEscapeUriFunction);
242
+ --
243
+ 2.47.1
244
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.8
4
+ version: 1.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -17,10 +17,9 @@ authors:
17
17
  - Sergio Arbeo
18
18
  - Timothy Elliott
19
19
  - Nobuyoshi Nakada
20
- autorequire:
21
20
  bindir: bin
22
21
  cert_chain: []
23
- date: 2024-12-02 00:00:00.000000000 Z
22
+ date: 2025-01-19 00:00:00.000000000 Z
24
23
  dependencies:
25
24
  - !ruby/object:Gem::Dependency
26
25
  name: mini_portile2
@@ -64,9 +63,10 @@ extra_rdoc_files:
64
63
  - ext/nokogiri/html4_document.c
65
64
  - ext/nokogiri/html4_element_description.c
66
65
  - ext/nokogiri/html4_entity_lookup.c
66
+ - ext/nokogiri/html4_sax_parser.c
67
67
  - ext/nokogiri/html4_sax_parser_context.c
68
68
  - ext/nokogiri/html4_sax_push_parser.c
69
- - ext/nokogiri/libxml2_backwards_compat.c
69
+ - ext/nokogiri/libxml2_polyfill.c
70
70
  - ext/nokogiri/nokogiri.c
71
71
  - ext/nokogiri/test_global_handlers.c
72
72
  - ext/nokogiri/xml_attr.c
@@ -109,9 +109,10 @@ files:
109
109
  - ext/nokogiri/html4_document.c
110
110
  - ext/nokogiri/html4_element_description.c
111
111
  - ext/nokogiri/html4_entity_lookup.c
112
+ - ext/nokogiri/html4_sax_parser.c
112
113
  - ext/nokogiri/html4_sax_parser_context.c
113
114
  - ext/nokogiri/html4_sax_push_parser.c
114
- - ext/nokogiri/libxml2_backwards_compat.c
115
+ - ext/nokogiri/libxml2_polyfill.c
115
116
  - ext/nokogiri/nokogiri.c
116
117
  - ext/nokogiri/nokogiri.h
117
118
  - ext/nokogiri/test_global_handlers.c
@@ -193,6 +194,7 @@ files:
193
194
  - lib/nokogiri/css/parser.rb
194
195
  - lib/nokogiri/css/parser.y
195
196
  - lib/nokogiri/css/parser_extras.rb
197
+ - lib/nokogiri/css/selector_cache.rb
196
198
  - lib/nokogiri/css/syntax_error.rb
197
199
  - lib/nokogiri/css/tokenizer.rb
198
200
  - lib/nokogiri/css/tokenizer.rex
@@ -214,6 +216,7 @@ files:
214
216
  - lib/nokogiri/html4/sax/parser_context.rb
215
217
  - lib/nokogiri/html4/sax/push_parser.rb
216
218
  - lib/nokogiri/html5.rb
219
+ - lib/nokogiri/html5/builder.rb
217
220
  - lib/nokogiri/html5/document.rb
218
221
  - lib/nokogiri/html5/document_fragment.rb
219
222
  - lib/nokogiri/html5/node.rb
@@ -265,13 +268,13 @@ files:
265
268
  - lib/xsd/xmlparser/nokogiri.rb
266
269
  - patches/libxml2/0001-Remove-script-macro-support.patch
267
270
  - patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch
268
- - patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch
269
271
  - patches/libxml2/0009-allow-wildcard-namespaces.patch
270
272
  - patches/libxml2/0010-update-config.guess-and-config.sub-for-libxml2.patch
271
273
  - patches/libxml2/0011-rip-out-libxml2-s-libc_single_threaded-support.patch
274
+ - patches/libxml2/0019-xpath-Use-separate-static-hash-table-for-standard-fu.patch
272
275
  - patches/libxslt/0001-update-config.guess-and-config.sub-for-libxslt.patch
273
- - ports/archives/libxml2-2.12.9.tar.xz
274
- - ports/archives/libxslt-1.1.39.tar.xz
276
+ - ports/archives/libxml2-2.13.5.tar.xz
277
+ - ports/archives/libxslt-1.1.42.tar.xz
275
278
  homepage: https://nokogiri.org
276
279
  licenses:
277
280
  - MIT
@@ -282,7 +285,6 @@ metadata:
282
285
  changelog_uri: https://nokogiri.org/CHANGELOG.html
283
286
  source_code_uri: https://github.com/sparklemotion/nokogiri
284
287
  rubygems_mfa_required: 'true'
285
- post_install_message:
286
288
  rdoc_options:
287
289
  - "--main"
288
290
  - README.md
@@ -292,15 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
292
294
  requirements:
293
295
  - - ">="
294
296
  - !ruby/object:Gem::Version
295
- version: 3.0.0
297
+ version: 3.1.0
296
298
  required_rubygems_version: !ruby/object:Gem::Requirement
297
299
  requirements:
298
300
  - - ">="
299
301
  - !ruby/object:Gem::Version
300
302
  version: '0'
301
303
  requirements: []
302
- rubygems_version: 3.5.11
303
- signing_key:
304
+ rubygems_version: 3.6.2
304
305
  specification_version: 4
305
306
  summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
306
307
  test_files: []
@@ -1,121 +0,0 @@
1
- #ifndef HAVE_XMLFIRSTELEMENTCHILD
2
- #include <nokogiri.h>
3
- /**
4
- * xmlFirstElementChild:
5
- * @parent: the parent node
6
- *
7
- * Finds the first child node of that element which is a Element node
8
- * Note the handling of entities references is different than in
9
- * the W3C DOM element traversal spec since we don't have back reference
10
- * from entities content to entities references.
11
- *
12
- * Returns the first element child or NULL if not available
13
- */
14
- xmlNodePtr
15
- xmlFirstElementChild(xmlNodePtr parent)
16
- {
17
- xmlNodePtr cur = NULL;
18
-
19
- if (parent == NULL) {
20
- return (NULL);
21
- }
22
- switch (parent->type) {
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
- }
32
- while (cur != NULL) {
33
- if (cur->type == XML_ELEMENT_NODE) {
34
- return (cur);
35
- }
36
- cur = cur->next;
37
- }
38
- return (NULL);
39
- }
40
-
41
- /**
42
- * xmlNextElementSibling:
43
- * @node: the current node
44
- *
45
- * Finds the first closest next sibling of the node which is an
46
- * element node.
47
- * Note the handling of entities references is different than in
48
- * the W3C DOM element traversal spec since we don't have back reference
49
- * from entities content to entities references.
50
- *
51
- * Returns the next element sibling or NULL if not available
52
- */
53
- xmlNodePtr
54
- xmlNextElementSibling(xmlNodePtr node)
55
- {
56
- if (node == NULL) {
57
- return (NULL);
58
- }
59
- switch (node->type) {
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
- }
75
- while (node != NULL) {
76
- if (node->type == XML_ELEMENT_NODE) {
77
- return (node);
78
- }
79
- node = node->next;
80
- }
81
- return (NULL);
82
- }
83
-
84
- /**
85
- * xmlLastElementChild:
86
- * @parent: the parent node
87
- *
88
- * Finds the last child node of that element which is a Element node
89
- * Note the handling of entities references is different than in
90
- * the W3C DOM element traversal spec since we don't have back reference
91
- * from entities content to entities references.
92
- *
93
- * Returns the last element child or NULL if not available
94
- */
95
- xmlNodePtr
96
- xmlLastElementChild(xmlNodePtr parent)
97
- {
98
- xmlNodePtr cur = NULL;
99
-
100
- if (parent == NULL) {
101
- return (NULL);
102
- }
103
- switch (parent->type) {
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
- }
113
- while (cur != NULL) {
114
- if (cur->type == XML_ELEMENT_NODE) {
115
- return (cur);
116
- }
117
- cur = cur->prev;
118
- }
119
- return (NULL);
120
- }
121
- #endif
@@ -1,25 +0,0 @@
1
- From 0b6ae484761fa01242fe8b67b54e3eb2d282d83d Mon Sep 17 00:00:00 2001
2
- From: Mike Dalessio <mike.dalessio@gmail.com>
3
- Date: Wed, 4 Dec 2019 08:43:51 -0500
4
- Subject: [PATCH] fix libxml2.la's path
5
-
6
- ---
7
- Makefile.in | 2 +-
8
- 1 file changed, 1 insertion(+), 1 deletion(-)
9
-
10
- diff --git a/Makefile.in b/Makefile.in
11
- index cf96d41..1372d8b 100644
12
- --- a/Makefile.in
13
- +++ b/Makefile.in
14
- @@ -1057,7 +1057,7 @@ clean-noinstLTLIBRARIES:
15
- rm -f $${locs}; \
16
- }
17
-
18
- -libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
19
- +$(top_builddir)/libxml2.la: $(libxml2_la_OBJECTS) $(libxml2_la_DEPENDENCIES) $(EXTRA_libxml2_la_DEPENDENCIES)
20
- $(AM_V_CCLD)$(libxml2_la_LINK) -rpath $(libdir) $(libxml2_la_OBJECTS) $(libxml2_la_LIBADD) $(LIBS)
21
-
22
- testdso.la: $(testdso_la_OBJECTS) $(testdso_la_DEPENDENCIES) $(EXTRA_testdso_la_DEPENDENCIES)
23
- --
24
- 2.17.1
25
-
Binary file
Binary file