leptris 1.9.355.0-arm-linux → 1.9.359.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.adoc +13 -5
  4. data/Rakefile +1 -1
  5. data/ext/leptris/native/native.c +383 -5
  6. data/lib/leptris/version.rb +1 -1
  7. data/lib/leptris/xml/cdata.rb +3 -0
  8. data/lib/leptris/xml/comment.rb +3 -0
  9. data/lib/leptris/xml/declaration.rb +59 -0
  10. data/lib/leptris/xml/doc_type.rb +33 -1
  11. data/lib/leptris/xml/document.rb +74 -2
  12. data/lib/leptris/xml/element.rb +21 -1
  13. data/lib/leptris/xml/entity_reference.rb +3 -0
  14. data/lib/leptris/xml/native.so +0 -0
  15. data/lib/leptris/xml/node_set.rb +22 -0
  16. data/lib/leptris/xml/processing_instruction.rb +3 -0
  17. data/lib/leptris/xml/sax/parser.rb +102 -78
  18. data/lib/leptris/xml/text.rb +4 -0
  19. data/lib/leptris/xml.rb +14 -0
  20. data/lib/libleptris.so +0 -0
  21. data/scripts/gem_smoke.rb +6 -3
  22. data/vendor-src/README.md +1 -1
  23. data/vendor-src/libleptris/CHANGELOG.md +134 -0
  24. data/vendor-src/libleptris/CMakeLists.txt +1 -1
  25. data/vendor-src/libleptris/TODO.xslt-full/REMAINING.md +37 -18
  26. data/vendor-src/libleptris/cli/commands/validate.c +15 -2
  27. data/vendor-src/libleptris/src/include/leptris.h +60 -4
  28. data/vendor-src/libleptris/src/leptris/dom/element.c +8 -0
  29. data/vendor-src/libleptris/src/leptris/dtd/content_check.c +280 -144
  30. data/vendor-src/libleptris/src/leptris/dtd/parser.c +17 -4
  31. data/vendor-src/libleptris/src/leptris/rng/parse.c +53 -8
  32. data/vendor-src/libleptris/src/leptris/rng/validate.c +63 -21
  33. data/vendor-src/libleptris/src/leptris/xinclude/xinclude.c +304 -12
  34. data/vendor-src/libleptris/src/leptris/xpath/evaluator.c +30 -0
  35. data/vendor-src/libleptris/src/leptris/xpath/evaluator.h +11 -0
  36. data/vendor-src/libleptris/src/leptris/xpath/evaluator_axes.c +3 -3
  37. data/vendor-src/libleptris/src/leptris/xpath/evaluator_path.c +4 -20
  38. data/vendor-src/libleptris/src/leptris/xpath/parser.c +4 -1
  39. data/vendor-src/libleptris/src/leptris/xpath/vm.c +41 -11
  40. data/vendor-src/libleptris/src/leptris/xpath/xpath_compiled.c +4 -3
  41. data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +2 -1
  42. data/vendor-src/libleptris/src/leptris/xsd/compile.c +981 -38
  43. data/vendor-src/libleptris/src/leptris/xsd/content_model.c +15 -3
  44. data/vendor-src/libleptris/src/leptris/xsd/validate.c +27 -9
  45. data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +1 -0
  46. data/vendor-src/libleptris/test/cli/test_cli.cpp +50 -14
  47. data/vendor-src/libleptris/test/dom/test_dom.cpp +27 -0
  48. data/vendor-src/libleptris/test/dtd/test_dtd_validate.cpp +80 -4
  49. data/vendor-src/libleptris/test/rng/include-cases/attr-text-choice.rng +18 -0
  50. data/vendor-src/libleptris/test/rng/include-cases/dup-inc-mid.rng +7 -0
  51. data/vendor-src/libleptris/test/rng/include-cases/dup-inc-shared.rng +5 -0
  52. data/vendor-src/libleptris/test/rng/include-cases/dup-inc-top.rng +6 -0
  53. data/vendor-src/libleptris/test/rng/test_rng.cpp +101 -0
  54. data/vendor-src/libleptris/test/xinclude/test_xinclude.cpp +261 -0
  55. data/vendor-src/libleptris/test/xpath/test_xpath.cpp +169 -0
  56. data/vendor-src/libleptris/test/xpath/test_xpath_conformance.cpp +8 -1
  57. data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +128 -11
  58. data/vendor-src/libleptris/vcpkg.json +1 -1
  59. metadata +7 -2
@@ -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 = ctx
268
- ? leptris_xpath_ns_lookup(
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 && ctx->ns_set) {
624
- test_uri = leptris_xpath_ns_lookup(
625
- (const struct leptris_xpath_ns_map*)ctx->ns_set,
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
- if (!node_is_element(input->nodes[i])) continue;
1128
- LeptrisElement elem = (LeptrisElement)input->nodes[i];
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 : leptris_document_root(doc);
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 : leptris_document_root(doc);
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 : leptris_document_root(doc);
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 : leptris_document_root(doc);
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 */