leptris 1.9.356.0-arm-linux → 1.9.360.0-arm-linux
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/README.adoc +13 -5
- data/Rakefile +1 -1
- data/ext/leptris/native/native.c +353 -1
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/cdata.rb +3 -0
- data/lib/leptris/xml/comment.rb +3 -0
- data/lib/leptris/xml/declaration.rb +64 -0
- data/lib/leptris/xml/doc_type.rb +33 -1
- data/lib/leptris/xml/document.rb +77 -2
- data/lib/leptris/xml/element.rb +21 -1
- data/lib/leptris/xml/entity_reference.rb +3 -0
- data/lib/leptris/xml/native.so +0 -0
- data/lib/leptris/xml/node_set.rb +22 -0
- data/lib/leptris/xml/processing_instruction.rb +3 -0
- data/lib/leptris/xml/sax/parser.rb +102 -78
- data/lib/leptris/xml/text.rb +4 -0
- data/lib/leptris/xml.rb +14 -0
- data/lib/libleptris.so +0 -0
- data/scripts/gem_smoke.rb +6 -3
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +95 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/TODO.xslt-full/REMAINING.md +37 -18
- data/vendor-src/libleptris/cli/commands/validate.c +15 -2
- data/vendor-src/libleptris/src/include/leptris.h +60 -4
- data/vendor-src/libleptris/src/leptris/dtd/content_check.c +280 -144
- data/vendor-src/libleptris/src/leptris/dtd/parser.c +17 -4
- data/vendor-src/libleptris/src/leptris/rng/parse.c +53 -8
- data/vendor-src/libleptris/src/leptris/rng/validate.c +63 -21
- data/vendor-src/libleptris/src/leptris/xinclude/xinclude.c +304 -12
- data/vendor-src/libleptris/src/leptris/xpath/evaluator.c +30 -0
- data/vendor-src/libleptris/src/leptris/xpath/evaluator.h +11 -0
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_axes.c +3 -3
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_path.c +4 -20
- data/vendor-src/libleptris/src/leptris/xpath/parser.c +4 -1
- data/vendor-src/libleptris/src/leptris/xpath/vm.c +41 -11
- data/vendor-src/libleptris/src/leptris/xpath/xpath_compiled.c +4 -3
- data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +2 -1
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +981 -38
- data/vendor-src/libleptris/src/leptris/xsd/content_model.c +15 -3
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +27 -9
- data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +1 -0
- data/vendor-src/libleptris/test/cli/test_cli.cpp +50 -14
- data/vendor-src/libleptris/test/dtd/test_dtd_validate.cpp +80 -4
- data/vendor-src/libleptris/test/rng/include-cases/attr-text-choice.rng +18 -0
- data/vendor-src/libleptris/test/rng/include-cases/dup-inc-mid.rng +7 -0
- data/vendor-src/libleptris/test/rng/include-cases/dup-inc-shared.rng +5 -0
- data/vendor-src/libleptris/test/rng/include-cases/dup-inc-top.rng +6 -0
- data/vendor-src/libleptris/test/rng/test_rng.cpp +101 -0
- data/vendor-src/libleptris/test/xinclude/test_xinclude.cpp +261 -0
- data/vendor-src/libleptris/test/xpath/test_xpath.cpp +169 -0
- data/vendor-src/libleptris/test/xpath/test_xpath_conformance.cpp +8 -1
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +128 -11
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +7 -2
|
@@ -506,9 +506,9 @@ static XPathNodeSet* axis_attribute(XPathContext* ctx, LeptrisElement node,
|
|
|
506
506
|
* may use a different prefix for the same namespace
|
|
507
507
|
* (libxslt bug-97). Unbound prefix: fall through to
|
|
508
508
|
* the literal compare (legacy behavior). */
|
|
509
|
-
const char* uri =
|
|
510
|
-
(
|
|
511
|
-
|
|
509
|
+
const char* uri =
|
|
510
|
+
xpath_expr_prefix_uri(ctx, tv,
|
|
511
|
+
(size_t)(tcolon - tv));
|
|
512
512
|
if (uri && !leptris_sv_is_empty(&attr->name_view)) {
|
|
513
513
|
const char* a = attr->name_view.data;
|
|
514
514
|
size_t al = attr->name_view.length;
|
|
@@ -176,11 +176,7 @@ int matches_node_test(XPathContext* ctx, LeptrisNode* node, XPathASTNode* test)
|
|
|
176
176
|
* that namespace via a different prefix or the default
|
|
177
177
|
* namespace. Unbound prefix falls through to the
|
|
178
178
|
* historic literal-prefix comparison. */
|
|
179
|
-
const char* test_uri = ctx
|
|
180
|
-
? leptris_xpath_ns_lookup(
|
|
181
|
-
(const struct leptris_xpath_ns_map*)ctx->ns_set,
|
|
182
|
-
test_prefix, prefix_len)
|
|
183
|
-
: NULL;
|
|
179
|
+
const char* test_uri = xpath_expr_prefix_uri(ctx, test_prefix, prefix_len);
|
|
184
180
|
if (test_uri) {
|
|
185
181
|
const char* node_uri = leptris_element_get_namespace_uri(elem);
|
|
186
182
|
return node_uri && strcmp(node_uri, test_uri) == 0 &&
|
|
@@ -207,11 +203,7 @@ int matches_node_test(XPathContext* ctx, LeptrisNode* node, XPathASTNode* test)
|
|
|
207
203
|
* previously ignored: //t:* matched EVERY element. */
|
|
208
204
|
if (test->prefix) {
|
|
209
205
|
size_t prefix_len = strlen(test->prefix);
|
|
210
|
-
const char* test_uri = ctx
|
|
211
|
-
? leptris_xpath_ns_lookup(
|
|
212
|
-
(const struct leptris_xpath_ns_map*)ctx->ns_set,
|
|
213
|
-
test->prefix, prefix_len)
|
|
214
|
-
: NULL;
|
|
206
|
+
const char* test_uri = xpath_expr_prefix_uri(ctx, test->prefix, prefix_len);
|
|
215
207
|
if (test_uri) {
|
|
216
208
|
const char* node_uri =
|
|
217
209
|
leptris_element_get_namespace_uri(elem);
|
|
@@ -231,11 +223,7 @@ int matches_node_test(XPathContext* ctx, LeptrisNode* node, XPathASTNode* test)
|
|
|
231
223
|
/* Has prefix (e.g., "ns1:*") - match namespace */
|
|
232
224
|
size_t prefix_len = colon - test->value;
|
|
233
225
|
|
|
234
|
-
const char* test_uri = ctx
|
|
235
|
-
? leptris_xpath_ns_lookup(
|
|
236
|
-
(const struct leptris_xpath_ns_map*)ctx->ns_set,
|
|
237
|
-
test->value, prefix_len)
|
|
238
|
-
: NULL;
|
|
226
|
+
const char* test_uri = xpath_expr_prefix_uri(ctx, test->value, prefix_len);
|
|
239
227
|
if (test_uri) {
|
|
240
228
|
const char* node_uri =
|
|
241
229
|
leptris_element_get_namespace_uri(elem);
|
|
@@ -1188,11 +1176,7 @@ struct leptris_xpath_result* evaluate_location_path(XPathContext* ctx,
|
|
|
1188
1176
|
* default). Unbound prefix falls back to the
|
|
1189
1177
|
* literal comparison. */
|
|
1190
1178
|
if (names_match && test_prefix) {
|
|
1191
|
-
const char* test_uri = ctx
|
|
1192
|
-
? leptris_xpath_ns_lookup(
|
|
1193
|
-
(const struct leptris_xpath_ns_map*)ctx->ns_set,
|
|
1194
|
-
test_prefix, strlen(test_prefix))
|
|
1195
|
-
: NULL;
|
|
1179
|
+
const char* test_uri = xpath_expr_prefix_uri(ctx, test_prefix, strlen(test_prefix));
|
|
1196
1180
|
if (test_uri) {
|
|
1197
1181
|
const char* root_uri =
|
|
1198
1182
|
leptris_element_get_namespace_uri(root);
|
|
@@ -3311,7 +3311,10 @@ static XPathASTNode* parse_location_path(XPathParser* parser) {
|
|
|
3311
3311
|
|
|
3312
3312
|
ast_node_add_child(node, desc_step);
|
|
3313
3313
|
|
|
3314
|
-
|
|
3314
|
+
/* Continue the path after the fused star step: the
|
|
3315
|
+
* fast path used to return bare, leaving a following
|
|
3316
|
+
* SLASH unconsumed (parse error at expression end). */
|
|
3317
|
+
return parse_path_continuation(parser, node);
|
|
3315
3318
|
}
|
|
3316
3319
|
|
|
3317
3320
|
/* General case: Add descendant-or-self::node() step */
|
|
@@ -264,11 +264,8 @@ static inline int vm_unprefixed_name_matches(XPathContext* ctx,
|
|
|
264
264
|
const char* local = colon + 1;
|
|
265
265
|
const char* en = leptris_element_get_name(e);
|
|
266
266
|
if (!en || strcmp(en, local) != 0) return 0;
|
|
267
|
-
const char* test_uri =
|
|
268
|
-
|
|
269
|
-
(const struct leptris_xpath_ns_map*)ctx->ns_set,
|
|
270
|
-
name, plen)
|
|
271
|
-
: NULL;
|
|
267
|
+
const char* test_uri =
|
|
268
|
+
xpath_expr_prefix_uri(ctx, name, plen);
|
|
272
269
|
if (test_uri) {
|
|
273
270
|
const char* node_uri = leptris_element_get_namespace_uri(e);
|
|
274
271
|
return node_uri && strcmp(node_uri, test_uri) == 0;
|
|
@@ -620,10 +617,9 @@ struct leptris_xpath_result* vm_apply_axis_attribute(XPathContext* ctx, XPathVM*
|
|
|
620
617
|
* different prefix for the same namespace (libxslt bug-97). */
|
|
621
618
|
const char* tcolon = name ? strchr(name, ':') : NULL;
|
|
622
619
|
const char* test_uri = NULL;
|
|
623
|
-
if (tcolon
|
|
624
|
-
test_uri =
|
|
625
|
-
|
|
626
|
-
name, (size_t)(tcolon - name));
|
|
620
|
+
if (tcolon) {
|
|
621
|
+
test_uri = xpath_expr_prefix_uri(ctx, name,
|
|
622
|
+
(size_t)(tcolon - name));
|
|
627
623
|
}
|
|
628
624
|
|
|
629
625
|
for (size_t i = 0; i < input->count; i++) {
|
|
@@ -1124,8 +1120,42 @@ struct leptris_xpath_result* vm_apply_axis_descendant(XPathContext* ctx, XPathVM
|
|
|
1124
1120
|
int need_dedup = (input->count > 1);
|
|
1125
1121
|
|
|
1126
1122
|
for (size_t i = 0; i < input->count; i++) {
|
|
1127
|
-
|
|
1128
|
-
|
|
1123
|
+
LeptrisNode* in_node = input->nodes[i];
|
|
1124
|
+
/* Document-node contexts (NULL-context evals ride the doc
|
|
1125
|
+
* node): every node below the document is a descendant —
|
|
1126
|
+
* walk the root subtree with include_self=1 (the root
|
|
1127
|
+
* element IS a descendant of the document, the same rule
|
|
1128
|
+
* the AST walker applies). Name/wild tests are element-
|
|
1129
|
+
* only, so document-level comments/PIs never match these
|
|
1130
|
+
* opcodes. */
|
|
1131
|
+
if (in_node && in_node->type == LEPTRIS_NODE_TYPE_DOCUMENT) {
|
|
1132
|
+
struct leptris_document* dd =
|
|
1133
|
+
((LeptrisDocumentNode*)in_node)->doc;
|
|
1134
|
+
LeptrisElement doc_root = (LeptrisElement)dd->new_dom_root;
|
|
1135
|
+
if (!doc_root) doc_root = dd->root;
|
|
1136
|
+
size_t mark = out->count;
|
|
1137
|
+
if (doc_root)
|
|
1138
|
+
descendant_walk(ctx, out, doc_root, name, wild, 1);
|
|
1139
|
+
if (need_dedup) {
|
|
1140
|
+
for (size_t k = mark; k < out->count; k++) {
|
|
1141
|
+
int dup = 0;
|
|
1142
|
+
for (size_t j = 0; j < mark; j++) {
|
|
1143
|
+
if (out->nodes[j] == out->nodes[k]) {
|
|
1144
|
+
dup = 1;
|
|
1145
|
+
break;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
if (dup) {
|
|
1149
|
+
out->nodes[k] = out->nodes[out->count - 1];
|
|
1150
|
+
out->count--;
|
|
1151
|
+
k--;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
if (!node_is_element(in_node)) continue;
|
|
1158
|
+
LeptrisElement elem = (LeptrisElement)in_node;
|
|
1129
1159
|
|
|
1130
1160
|
size_t mark = out->count;
|
|
1131
1161
|
descendant_walk(ctx, out, elem, name, wild, include_self);
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* handle concurrently against different documents. Free the handle
|
|
12
12
|
* only after the last evaluation returns. */
|
|
13
13
|
#include "xpath_internal.h"
|
|
14
|
+
#include "../dom/document_node.h"
|
|
14
15
|
#include "parser.h"
|
|
15
16
|
#include "bytecode.h"
|
|
16
17
|
#include "evaluator_internal.h"
|
|
@@ -96,7 +97,7 @@ LEPTRIS_API LeptrisXPathResult leptris_xpath_compiled_eval(
|
|
|
96
97
|
if (!compiled || !doc) return NULL;
|
|
97
98
|
|
|
98
99
|
LeptrisElement context_elem =
|
|
99
|
-
context ? context :
|
|
100
|
+
context ? context : (LeptrisElement)leptris_document_get_node(doc);
|
|
100
101
|
if (!context_elem) return NULL;
|
|
101
102
|
|
|
102
103
|
XPathContext ctx_storage;
|
|
@@ -125,7 +126,7 @@ static struct leptris_xpath_result* compiled_eval_context(
|
|
|
125
126
|
if (!compiled || !doc) return NULL;
|
|
126
127
|
|
|
127
128
|
LeptrisElement context_elem =
|
|
128
|
-
context ? context :
|
|
129
|
+
context ? context : (LeptrisElement)leptris_document_get_node(doc);
|
|
129
130
|
if (!context_elem) return NULL;
|
|
130
131
|
|
|
131
132
|
XPathContext ctx_storage;
|
|
@@ -227,7 +228,7 @@ struct leptris_xpath_result* leptris_xpath_compiled_eval_ctx(
|
|
|
227
228
|
pos, size);
|
|
228
229
|
|
|
229
230
|
LeptrisElement context_elem =
|
|
230
|
-
context ? context :
|
|
231
|
+
context ? context : (LeptrisElement)leptris_document_get_node(doc);
|
|
231
232
|
if (!context_elem) return NULL;
|
|
232
233
|
|
|
233
234
|
XPathContext ctx_storage;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
#include "../dom/pi.h"
|
|
9
|
+
#include "../dom/document_node.h"
|
|
9
10
|
#include "xpath_carrier.h"
|
|
10
11
|
#include "../include/leptris.h"
|
|
11
12
|
#include "../leptris_internal.h"
|
|
@@ -109,7 +110,7 @@ LEPTRIS_API LeptrisXPathResult leptris_xpath_eval(
|
|
|
109
110
|
* the compact-pointer DOM via the bytecode VM. */
|
|
110
111
|
|
|
111
112
|
/* Use context element if provided, otherwise use root */
|
|
112
|
-
LeptrisElement context_elem = context ? context :
|
|
113
|
+
LeptrisElement context_elem = context ? context : (LeptrisElement)leptris_document_get_node(doc);
|
|
113
114
|
if (!context_elem) return NULL;
|
|
114
115
|
|
|
115
116
|
/* Call internal implementation with string length */
|