nokolexbor 0.2.5 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/nokolexbor/CMakeLists.txt +7 -4
- data/ext/nokolexbor/config.h.cmake.in +2 -0
- data/ext/nokolexbor/extconf.rb +47 -25
- data/ext/nokolexbor/libxml/SAX2.h +4 -4
- data/ext/nokolexbor/libxml/chvalid.h +21 -21
- data/ext/nokolexbor/libxml/dict.h +13 -13
- data/ext/nokolexbor/libxml/globals.h +202 -202
- data/ext/nokolexbor/libxml/hash.h +25 -25
- data/ext/nokolexbor/libxml/parser.h +5 -5
- data/ext/nokolexbor/libxml/parserInternals.h +4 -4
- data/ext/nokolexbor/libxml/pattern.h +14 -14
- data/ext/nokolexbor/libxml/threads.h +15 -15
- data/ext/nokolexbor/libxml/tree.h +5 -5
- data/ext/nokolexbor/libxml/xmlerror.h +5 -5
- data/ext/nokolexbor/libxml/xmlmemory.h +16 -16
- data/ext/nokolexbor/libxml/xmlstring.h +30 -30
- data/ext/nokolexbor/libxml/xpath.h +43 -43
- data/ext/nokolexbor/libxml/xpathInternals.h +128 -128
- data/ext/nokolexbor/memory.c +6 -6
- data/ext/nokolexbor/nl_cdata.c +44 -0
- data/ext/nokolexbor/nl_comment.c +44 -0
- data/ext/nokolexbor/nl_document.c +23 -9
- data/ext/nokolexbor/nl_node.c +191 -178
- data/ext/nokolexbor/nl_node_set.c +38 -73
- data/ext/nokolexbor/nl_text.c +44 -0
- data/ext/nokolexbor/nl_xpath_context.c +33 -42
- data/ext/nokolexbor/nokolexbor.c +7 -3
- data/ext/nokolexbor/nokolexbor.h +9 -7
- data/ext/nokolexbor/private/buf.h +1 -1
- data/ext/nokolexbor/private/error.h +3 -3
- data/ext/nokolexbor/xml_SAX2.c +8 -8
- data/ext/nokolexbor/xml_buf.c +19 -19
- data/ext/nokolexbor/xml_chvalid.c +25 -25
- data/ext/nokolexbor/xml_dict.c +69 -69
- data/ext/nokolexbor/xml_encoding.c +2 -2
- data/ext/nokolexbor/xml_error.c +51 -51
- data/ext/nokolexbor/xml_globals.c +329 -329
- data/ext/nokolexbor/xml_hash.c +131 -131
- data/ext/nokolexbor/xml_memory.c +25 -25
- data/ext/nokolexbor/xml_parser.c +3 -3
- data/ext/nokolexbor/xml_parserInternals.c +15 -15
- data/ext/nokolexbor/xml_pattern.c +103 -103
- data/ext/nokolexbor/xml_string.c +93 -93
- data/ext/nokolexbor/xml_threads.c +61 -61
- data/ext/nokolexbor/xml_tree.c +12 -12
- data/ext/nokolexbor/xml_xpath.c +1194 -1203
- data/lib/nokolexbor/document.rb +92 -1
- data/lib/nokolexbor/node.rb +64 -0
- data/lib/nokolexbor/node_set.rb +6 -5
- data/lib/nokolexbor/version.rb +1 -1
- data/lib/nokolexbor.rb +21 -1
- data/patches/0001-lexbor-support-text-pseudo-element.patch +1 -1
- metadata +7 -4
data/ext/nokolexbor/xml_error.c
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
char *larger; \
|
10
10
|
va_list ap; \
|
11
11
|
\
|
12
|
-
str = (char *)
|
12
|
+
str = (char *) nl_xmlMalloc(150); \
|
13
13
|
if (str != NULL) { \
|
14
14
|
\
|
15
15
|
size = 150; \
|
@@ -29,7 +29,7 @@
|
|
29
29
|
size += chars + 1; \
|
30
30
|
else \
|
31
31
|
size += 100; \
|
32
|
-
if ((larger = (char *)
|
32
|
+
if ((larger = (char *) nl_xmlRealloc(str, size)) == NULL) {\
|
33
33
|
break; \
|
34
34
|
} \
|
35
35
|
str = larger; \
|
@@ -37,7 +37,7 @@
|
|
37
37
|
}
|
38
38
|
|
39
39
|
/**
|
40
|
-
*
|
40
|
+
* nl_xmlGenericErrorDefaultFunc:
|
41
41
|
* @ctx: an error context
|
42
42
|
* @msg: the message to display/transmit
|
43
43
|
* @...: extra parameters for the message display
|
@@ -45,11 +45,11 @@
|
|
45
45
|
* Default handler for out of context error messages.
|
46
46
|
*/
|
47
47
|
void XMLCDECL
|
48
|
-
|
48
|
+
nl_xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
49
49
|
}
|
50
50
|
|
51
51
|
/**
|
52
|
-
*
|
52
|
+
* nl_xmlCopyError:
|
53
53
|
* @from: a source error
|
54
54
|
* @to: a target error
|
55
55
|
*
|
@@ -58,28 +58,28 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
|
58
58
|
* Returns 0 in case of success and -1 in case of error.
|
59
59
|
*/
|
60
60
|
int
|
61
|
-
|
61
|
+
nl_xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) {
|
62
62
|
char *message, *file, *str1, *str2, *str3;
|
63
63
|
|
64
64
|
if ((from == NULL) || (to == NULL))
|
65
65
|
return(-1);
|
66
66
|
|
67
|
-
message = (char *)
|
68
|
-
file = (char *)
|
69
|
-
str1 = (char *)
|
70
|
-
str2 = (char *)
|
71
|
-
str3 = (char *)
|
67
|
+
message = (char *) nl_xmlStrdup((xmlChar *) from->message);
|
68
|
+
file = (char *) nl_xmlStrdup ((xmlChar *) from->file);
|
69
|
+
str1 = (char *) nl_xmlStrdup ((xmlChar *) from->str1);
|
70
|
+
str2 = (char *) nl_xmlStrdup ((xmlChar *) from->str2);
|
71
|
+
str3 = (char *) nl_xmlStrdup ((xmlChar *) from->str3);
|
72
72
|
|
73
73
|
if (to->message != NULL)
|
74
|
-
|
74
|
+
nl_xmlFree(to->message);
|
75
75
|
if (to->file != NULL)
|
76
|
-
|
76
|
+
nl_xmlFree(to->file);
|
77
77
|
if (to->str1 != NULL)
|
78
|
-
|
78
|
+
nl_xmlFree(to->str1);
|
79
79
|
if (to->str2 != NULL)
|
80
|
-
|
80
|
+
nl_xmlFree(to->str2);
|
81
81
|
if (to->str3 != NULL)
|
82
|
-
|
82
|
+
nl_xmlFree(to->str3);
|
83
83
|
to->domain = from->domain;
|
84
84
|
to->code = from->code;
|
85
85
|
to->level = from->level;
|
@@ -99,7 +99,7 @@ xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) {
|
|
99
99
|
}
|
100
100
|
|
101
101
|
/**
|
102
|
-
*
|
102
|
+
* __nl_xmlRaiseError:
|
103
103
|
* @schannel: the structured callback channel
|
104
104
|
* @channel: the old callback channel
|
105
105
|
* @data: the callback data
|
@@ -123,7 +123,7 @@ xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) {
|
|
123
123
|
* error callback handler
|
124
124
|
*/
|
125
125
|
void XMLCDECL
|
126
|
-
|
126
|
+
__nl_xmlRaiseError(xmlStructuredErrorFunc schannel,
|
127
127
|
xmlGenericErrorFunc channel, void *data, void *ctx,
|
128
128
|
void *nod, int domain, int code, xmlErrorLevel level,
|
129
129
|
const char *file, int line, const char *str1,
|
@@ -134,12 +134,12 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
|
|
134
134
|
lxb_dom_node_t_ptr node = (lxb_dom_node_t_ptr)nod;
|
135
135
|
char *str = NULL;
|
136
136
|
xmlParserInputPtr input = NULL;
|
137
|
-
xmlErrorPtr to = &
|
137
|
+
xmlErrorPtr to = &nl_xmlLastError;
|
138
138
|
lxb_dom_node_t_ptr baseptr = NULL;
|
139
139
|
|
140
140
|
if (code == XML_ERR_OK)
|
141
141
|
return;
|
142
|
-
if ((
|
142
|
+
if ((nl_xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING))
|
143
143
|
return;
|
144
144
|
if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
|
145
145
|
(domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
|
@@ -159,19 +159,19 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
|
|
159
159
|
*/
|
160
160
|
if (schannel == NULL)
|
161
161
|
{
|
162
|
-
schannel =
|
162
|
+
schannel = nl_xmlStructuredError;
|
163
163
|
/*
|
164
164
|
* if user has defined handler, change data ptr to user's choice
|
165
165
|
*/
|
166
166
|
if (schannel != NULL)
|
167
|
-
data =
|
167
|
+
data = nl_xmlStructuredErrorContext;
|
168
168
|
}
|
169
169
|
/*
|
170
170
|
* Formatting the message
|
171
171
|
*/
|
172
172
|
if (msg == NULL)
|
173
173
|
{
|
174
|
-
str = (char *)
|
174
|
+
str = (char *)nl_xmlStrdup(BAD_CAST "No error message provided");
|
175
175
|
}
|
176
176
|
else
|
177
177
|
{
|
@@ -204,27 +204,27 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
|
|
204
204
|
/*
|
205
205
|
* Save the information about the error
|
206
206
|
*/
|
207
|
-
|
207
|
+
nl_xmlResetError(to);
|
208
208
|
to->domain = domain;
|
209
209
|
to->code = code;
|
210
210
|
to->message = str;
|
211
211
|
to->level = level;
|
212
212
|
if (file != NULL)
|
213
|
-
to->file = (char *)
|
213
|
+
to->file = (char *)nl_xmlStrdup((const xmlChar *)file);
|
214
214
|
to->line = line;
|
215
215
|
if (str1 != NULL)
|
216
|
-
to->str1 = (char *)
|
216
|
+
to->str1 = (char *)nl_xmlStrdup((const xmlChar *)str1);
|
217
217
|
if (str2 != NULL)
|
218
|
-
to->str2 = (char *)
|
218
|
+
to->str2 = (char *)nl_xmlStrdup((const xmlChar *)str2);
|
219
219
|
if (str3 != NULL)
|
220
|
-
to->str3 = (char *)
|
220
|
+
to->str3 = (char *)nl_xmlStrdup((const xmlChar *)str3);
|
221
221
|
to->int1 = int1;
|
222
222
|
to->int2 = col;
|
223
223
|
to->node = node;
|
224
224
|
to->ctxt = ctx;
|
225
225
|
|
226
|
-
if (to != &
|
227
|
-
|
226
|
+
if (to != &nl_xmlLastError)
|
227
|
+
nl_xmlCopyError(to, &nl_xmlLastError);
|
228
228
|
|
229
229
|
if (schannel != NULL)
|
230
230
|
{
|
@@ -233,34 +233,34 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
|
|
233
233
|
}
|
234
234
|
|
235
235
|
/**
|
236
|
-
*
|
236
|
+
* nl_xmlResetError:
|
237
237
|
* @err: pointer to the error.
|
238
238
|
*
|
239
239
|
* Cleanup the error.
|
240
240
|
*/
|
241
241
|
void
|
242
|
-
|
242
|
+
nl_xmlResetError(xmlErrorPtr err)
|
243
243
|
{
|
244
244
|
if (err == NULL)
|
245
245
|
return;
|
246
246
|
if (err->code == XML_ERR_OK)
|
247
247
|
return;
|
248
248
|
if (err->message != NULL)
|
249
|
-
|
249
|
+
nl_xmlFree(err->message);
|
250
250
|
if (err->file != NULL)
|
251
|
-
|
251
|
+
nl_xmlFree(err->file);
|
252
252
|
if (err->str1 != NULL)
|
253
|
-
|
253
|
+
nl_xmlFree(err->str1);
|
254
254
|
if (err->str2 != NULL)
|
255
|
-
|
255
|
+
nl_xmlFree(err->str2);
|
256
256
|
if (err->str3 != NULL)
|
257
|
-
|
257
|
+
nl_xmlFree(err->str3);
|
258
258
|
memset(err, 0, sizeof(xmlError));
|
259
259
|
err->code = XML_ERR_OK;
|
260
260
|
}
|
261
261
|
|
262
262
|
/**
|
263
|
-
*
|
263
|
+
* __nl_xmlSimpleError:
|
264
264
|
* @domain: where the error comes from
|
265
265
|
* @code: the error code
|
266
266
|
* @node: the context node
|
@@ -269,29 +269,29 @@ xmlResetError(xmlErrorPtr err)
|
|
269
269
|
* Handle an out of memory condition
|
270
270
|
*/
|
271
271
|
void
|
272
|
-
|
272
|
+
__nl_xmlSimpleError(int domain, int code, lxb_dom_node_t_ptr node,
|
273
273
|
const char *msg, const char *extra)
|
274
274
|
{
|
275
275
|
|
276
276
|
if (code == XML_ERR_NO_MEMORY) {
|
277
277
|
if (extra)
|
278
|
-
|
278
|
+
__nl_xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
|
279
279
|
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra,
|
280
280
|
NULL, NULL, 0, 0,
|
281
281
|
"Memory allocation failed : %s\n", extra);
|
282
282
|
else
|
283
|
-
|
283
|
+
__nl_xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
|
284
284
|
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL,
|
285
285
|
NULL, NULL, 0, 0, "Memory allocation failed\n");
|
286
286
|
} else {
|
287
|
-
|
287
|
+
__nl_xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
|
288
288
|
code, XML_ERR_ERROR, NULL, 0, extra,
|
289
289
|
NULL, NULL, 0, 0, msg, extra);
|
290
290
|
}
|
291
291
|
}
|
292
292
|
|
293
293
|
/**
|
294
|
-
*
|
294
|
+
* nl_xmlSetGenericErrorFunc:
|
295
295
|
* @ctx: the new error handling context
|
296
296
|
* @handler: the new handler function
|
297
297
|
*
|
@@ -305,16 +305,16 @@ __xmlSimpleError(int domain, int code, lxb_dom_node_t_ptr node,
|
|
305
305
|
* For multi-threaded applications, this must be set separately for each thread.
|
306
306
|
*/
|
307
307
|
void
|
308
|
-
|
309
|
-
|
308
|
+
nl_xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
|
309
|
+
nl_xmlGenericErrorContext = ctx;
|
310
310
|
if (handler != NULL)
|
311
|
-
|
311
|
+
nl_xmlGenericError = handler;
|
312
312
|
else
|
313
|
-
|
313
|
+
nl_xmlGenericError = nl_xmlGenericErrorDefaultFunc;
|
314
314
|
}
|
315
315
|
|
316
316
|
/**
|
317
|
-
*
|
317
|
+
* nl_xmlSetStructuredErrorFunc:
|
318
318
|
* @ctx: the new error handling context
|
319
319
|
* @handler: the new handler function
|
320
320
|
*
|
@@ -326,7 +326,7 @@ xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
|
|
326
326
|
* For multi-threaded applications, this must be set separately for each thread.
|
327
327
|
*/
|
328
328
|
void
|
329
|
-
|
330
|
-
|
331
|
-
|
329
|
+
nl_xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
|
330
|
+
nl_xmlStructuredErrorContext = ctx;
|
331
|
+
nl_xmlStructuredError = handler;
|
332
332
|
}
|