leptris 1.9.336.0-ppc64le-linux → 1.9.338.0-ppc64le-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/CHANGELOG.md +27 -0
- data/Rakefile +1 -1
- data/lib/leptris/html.rb +91 -0
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/document.rb +3 -2
- data/lib/leptris/xml/ffi.rb +6 -1
- data/lib/leptris/xml/serialization.rb +23 -3
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +29 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/include/leptris/types.h +8 -0
- data/vendor-src/libleptris/src/leptris/html/html_parse.c +31 -8
- data/vendor-src/libleptris/src/leptris/serialize/serialize.c +56 -13
- data/vendor-src/libleptris/src/leptris/serialize/serialize.h +4 -0
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +48 -8
- data/vendor-src/libleptris/test/serializer/test_serialize.cpp +93 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +59 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce85fb7ab2268105ba00b64085496a4ab58d2d5441c462291bb7524f9e40fbe3
|
|
4
|
+
data.tar.gz: aafe8817de40bcbd064eb08a1db40979d946af52ce56e5b3a7feaf3898f0c567
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cea4b4de37ab06db80226c382339c61c1ae7e638647935b5a1010f1b76794dd13bcf7fba690bfbf2caae6bede398254628282a5f9d788f3b0927449e37e76a6
|
|
7
|
+
data.tar.gz: 501ce0d6632995380891b21a2289e39a72f55c3601b76a5fc2558010598cdf95a6fdf4f93c2a2fe3f9c0e68215a69221c7ff70d197276ae003f3ee4abb673ce9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
## [1.9.337.0] - 2026-10-11
|
|
2
|
+
|
|
3
|
+
### Added — engine sync (libleptris 1.9.337)
|
|
4
|
+
|
|
5
|
+
- **XSD instance errors carry the owning element and source
|
|
6
|
+
position (#419, engine PR #1632)**: the libxml2/Nokogiri-
|
|
7
|
+
presentable shape — `element 'pgMar' @2:22: attribute 'header':
|
|
8
|
+
required but absent` — across attribute rows (required-absent,
|
|
9
|
+
fixed mismatch, strict-undeclared), strict elements, unresolved
|
|
10
|
+
types, and content-model failures (the #1626 culprit naming
|
|
11
|
+
rides along). Position from the recorded parse-time source
|
|
12
|
+
stamp; prior form for skipped-position parses and
|
|
13
|
+
`simple_valid`. Pinned for attribute and content shapes.
|
|
14
|
+
|
|
15
|
+
## [1.9.336.0] - 2026-10-11
|
|
16
|
+
|
|
17
|
+
### Fixed — engine sync (libleptris 1.9.336)
|
|
18
|
+
|
|
19
|
+
- **build_result members emit in op order on every platform
|
|
20
|
+
(#1625, engine PR #1629)**: the serializer's byte-position
|
|
21
|
+
qsort broke ties on unspecified libc behavior and REVERSED
|
|
22
|
+
builder-created members on Windows (x64 and arm64). Builder
|
|
23
|
+
values carry a dense insertion rank now — the comparator is a
|
|
24
|
+
total order and platform-independent. Pinned with the
|
|
25
|
+
four-member out-of-row-order shape (the Windows CI legs
|
|
26
|
+
enforce it); walk output undisturbed.
|
|
27
|
+
|
|
1
28
|
## [1.9.335.0] - 2026-10-11
|
|
2
29
|
|
|
3
30
|
### Fixed — engine sync (libleptris 1.9.335)
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.338"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
data/lib/leptris/html.rb
CHANGED
|
@@ -21,6 +21,78 @@
|
|
|
21
21
|
# elements serialize with the HTML5-legal trailing slash).
|
|
22
22
|
module Leptris
|
|
23
23
|
module HTML
|
|
24
|
+
# WHATWG fragment parsing with a context element (#1634 /
|
|
25
|
+
# moxml#353). Composed over the WHATWG lane: the fragment runs
|
|
26
|
+
# inside the context element's ancestor chain, so tree
|
|
27
|
+
# construction lands in the right insertion mode (body context
|
|
28
|
+
# keeps <title>/<meta> at fragment top level; table contexts
|
|
29
|
+
# take the in-table rules). The wrapper document stays alive
|
|
30
|
+
# for the fragment's lifetime - children address its pool.
|
|
31
|
+
class Fragment
|
|
32
|
+
# chains are the ancestors the parser opens before the
|
|
33
|
+
# fragment: the innermost element carries the children
|
|
34
|
+
TABLE_CHAINS = {
|
|
35
|
+
table: %w[table],
|
|
36
|
+
tbody: %w[table tbody],
|
|
37
|
+
thead: %w[table thead],
|
|
38
|
+
tfoot: %w[table tfoot],
|
|
39
|
+
tr: %w[table tbody tr],
|
|
40
|
+
td: %w[table tbody tr td],
|
|
41
|
+
th: %w[table tbody tr th],
|
|
42
|
+
caption: %w[table caption],
|
|
43
|
+
colgroup: %w[table colgroup],
|
|
44
|
+
}.freeze
|
|
45
|
+
|
|
46
|
+
def initialize(document, chain)
|
|
47
|
+
# The wrapper document always carries a body (explicit tag
|
|
48
|
+
# or synthesis); table chains nest under it.
|
|
49
|
+
@document = document
|
|
50
|
+
el = first_element_named(document.root, "body")
|
|
51
|
+
chain.each do |tag|
|
|
52
|
+
break unless el
|
|
53
|
+
el = first_element_named(el, tag)
|
|
54
|
+
end
|
|
55
|
+
@context = el
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# The parsed top-level nodes (text, elements, comments) in
|
|
59
|
+
# tree order - the fragment's children, Nokogiri's
|
|
60
|
+
# DocumentFragment#children shape.
|
|
61
|
+
def children
|
|
62
|
+
@context ? @context.children.to_a : []
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def each(&block)
|
|
66
|
+
children.each(&block)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
include Enumerable
|
|
70
|
+
|
|
71
|
+
def size
|
|
72
|
+
children.size
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def empty?
|
|
76
|
+
children.empty?
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# The fragment serialized as its children joined (HTML
|
|
80
|
+
# method per node; text verbatim).
|
|
81
|
+
def to_html
|
|
82
|
+
children.map do |c|
|
|
83
|
+
c.is_a?(Leptris::XML::Text) ? c.content : c.to_html
|
|
84
|
+
end.join
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
private
|
|
88
|
+
|
|
89
|
+
def first_element_named(parent, name)
|
|
90
|
+
parent.children.find do |c|
|
|
91
|
+
c.is_a?(Leptris::XML::Element) && c.name == name
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
24
96
|
module_function
|
|
25
97
|
|
|
26
98
|
# Nokogiri::HTML shape: the default lane is html4 (byte-parity
|
|
@@ -29,6 +101,25 @@ module Leptris
|
|
|
29
101
|
Leptris::XML.parse_html(html, mode: :html4)
|
|
30
102
|
end
|
|
31
103
|
|
|
104
|
+
# WHATWG fragment parse (body context by default; the table
|
|
105
|
+
# contexts wrap their ancestor chain). Matches
|
|
106
|
+
# Nokogiri::HTML5.fragment semantics on the head-sweep and
|
|
107
|
+
# foster-parenting divergence set (verified against the
|
|
108
|
+
# html5lib trees).
|
|
109
|
+
def parse_fragment(html, context: :body)
|
|
110
|
+
chain = context == :body ? ["body"] : Fragment::TABLE_CHAINS.fetch(context) do
|
|
111
|
+
raise ArgumentError,
|
|
112
|
+
"context must be :body or a table context " \
|
|
113
|
+
"(#{(Fragment::TABLE_CHAINS.keys + [:body]).join(', ')}), " \
|
|
114
|
+
"got #{context.inspect}"
|
|
115
|
+
end
|
|
116
|
+
prefix = "<body>#{chain.map { |t| "<#{t}>" }.join}"
|
|
117
|
+
suffix = "#{chain.reverse.map { |t| "</#{t}>" }.join}</body>"
|
|
118
|
+
wrapped = "#{prefix}#{html}#{suffix}"
|
|
119
|
+
Fragment.new(Leptris::HTML5.parse(wrapped),
|
|
120
|
+
chain.first == "body" ? chain.drop(1) : chain)
|
|
121
|
+
end
|
|
122
|
+
|
|
32
123
|
# Fresh document with the HTML 4.01 Transitional doctype preset
|
|
33
124
|
# (Nokogiri::HTML::Builder's .doc carries the same). Pass
|
|
34
125
|
# +doctype: nil+ for a bare document.
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/document.rb
CHANGED
|
@@ -546,9 +546,10 @@ class Leptris::XML::Document
|
|
|
546
546
|
# entity escaping per HTML rules, the DOCTYPE emitted first.
|
|
547
547
|
# Walks the tree in Ruby — the engine-side serialization mode is
|
|
548
548
|
# the perf headroom this face gates on.
|
|
549
|
-
def to_html
|
|
549
|
+
def to_html(indent: 0, indent_text: nil)
|
|
550
550
|
raise Leptris::XML::UseAfterFreeError if @freed.state == :freed
|
|
551
|
-
Leptris::XML::Serialization.document_html(
|
|
551
|
+
Leptris::XML::Serialization.document_html(
|
|
552
|
+
c_ptr, indent: indent, indent_text: indent_text)
|
|
552
553
|
end
|
|
553
554
|
|
|
554
555
|
def save(path, mode: :xml, **opts)
|
data/lib/leptris/xml/ffi.rb
CHANGED
|
@@ -205,7 +205,12 @@ module Leptris
|
|
|
205
205
|
# libleptris 1.9.225 (#1311): tri-state — 0 = the
|
|
206
206
|
# document's default method, 1 = force HTML, -1 =
|
|
207
207
|
# force XML (to_xml on an HTML document).
|
|
208
|
-
:html_method, :int
|
|
208
|
+
:html_method, :int,
|
|
209
|
+
# libleptris 1.9.xxx (#1635): 1 = the html layout
|
|
210
|
+
# nests with the indent machinery (libxml2 format
|
|
211
|
+
# mode); 0 = the §16.2 newline-only shape. Appended —
|
|
212
|
+
# the sized entry keeps older allocations zeroed.
|
|
213
|
+
:indent_html, :int
|
|
209
214
|
end
|
|
210
215
|
|
|
211
216
|
# Mirrors LeptrisParseOptions (libleptris >= 1.9.0 carries the
|
|
@@ -60,10 +60,30 @@ module Leptris::XML::Serialization
|
|
|
60
60
|
# one FFI fast-path dispatch per child.
|
|
61
61
|
# Document HTML serialization (libleptris 1.9.225, #1311): the
|
|
62
62
|
# native HTML mode — voids unclosed, raw-text script/style,
|
|
63
|
-
# explicit closes, no declaration, DOCTYPE first.
|
|
64
|
-
|
|
63
|
+
# explicit closes, no declaration, DOCTYPE first. With +indent+
|
|
64
|
+
# (spaces per level) or +indent_text+ (a unit string like "\t"),
|
|
65
|
+
# the ext serializer runs method="html" layout over the standard
|
|
66
|
+
# indent machinery (moxml#354 / leptris#1635): line breaks around
|
|
67
|
+
# block/element children per the HTML element table, raw-text and
|
|
68
|
+
# mixed content verbatim.
|
|
69
|
+
def self.document_html(c_ptr, indent: 0, indent_text: nil)
|
|
70
|
+
if indent.to_i.zero? && indent_text.nil?
|
|
71
|
+
return Leptris::XML::FFI.read_owned_string(
|
|
72
|
+
Leptris::XML::FFI.leptris_document_serialize_html(c_ptr, nil))
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
opts, _encoding_anchor = build_options(indent: indent, no_decl: true)
|
|
76
|
+
ext = Leptris::XML::FFI::SerializeExtStruct.new
|
|
77
|
+
ext[:html_method] = 1
|
|
78
|
+
ext[:indent_html] = 1
|
|
79
|
+
unit_anchor = nil
|
|
80
|
+
if indent_text
|
|
81
|
+
unit_anchor = ::FFI::MemoryPointer.from_string(indent_text.to_s)
|
|
82
|
+
ext[:indent_unit] = unit_anchor
|
|
83
|
+
end
|
|
65
84
|
Leptris::XML::FFI.read_owned_string(
|
|
66
|
-
Leptris::XML::FFI.
|
|
85
|
+
Leptris::XML::FFI.leptris_document_serialize_ext_sized(
|
|
86
|
+
c_ptr, opts.pointer, ext.pointer, ext.size))
|
|
67
87
|
end
|
|
68
88
|
|
|
69
89
|
# Element-level HTML mode through the ext serializer (the
|
data/lib/libleptris.so
CHANGED
|
Binary file
|
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.338] - 2026-10-11
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- indent_html ext option — nested HTML indent (#1635) (serialize)
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- in-body drops the table-structure start tags (#1634) (html)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [1.9.337] - 2026-10-11
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **XSD instance errors carry the owning element and source
|
|
20
|
+
position (leptris-ruby#419, PR #1632).** In the libxml2/Nokogiri
|
|
21
|
+
shape consumers present: `element 'pgMar' @2:3: attribute
|
|
22
|
+
'header': required but absent`. Applied to attribute rows
|
|
23
|
+
(required-absent, fixed mismatch, strict-undeclared), strict
|
|
24
|
+
elements, unresolved types, and content-model failures — the
|
|
25
|
+
#1626 culprit naming rides along. The position comes from the
|
|
26
|
+
recorded parse-time source stamp and falls back to the prior
|
|
27
|
+
form for skipped-positions parses and the public `simple_valid`
|
|
28
|
+
face. Compile-time schema errors are unchanged.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
3
32
|
## [1.9.336] - 2026-10-10
|
|
4
33
|
|
|
5
34
|
### Fixed
|
|
@@ -360,6 +360,14 @@ typedef struct {
|
|
|
360
360
|
* 1 = force HTML on any document, -1 = force XML (to_xml on an
|
|
361
361
|
* HTML document). XSLT method="html" maps to 1. */
|
|
362
362
|
int html_method;
|
|
363
|
+
/* 1 = the html-method layout NESTS with the indent machinery
|
|
364
|
+
* (spaces / unit) like libxml2 htmlNodeDumpFormatOutput
|
|
365
|
+
* format=1 (#1635): leads before block children and close tags,
|
|
366
|
+
* mixed follows actual text children, raw text stays verbatim.
|
|
367
|
+
* 0 = the historical §16.2 newline-only shape (XSLT
|
|
368
|
+
* method="html"). Meaningful only with html_method=1 and
|
|
369
|
+
* options->indent > 0. */
|
|
370
|
+
int indent_html;
|
|
363
371
|
} LeptrisSerializeExtOptions;
|
|
364
372
|
|
|
365
373
|
/* ============================================================================
|
|
@@ -7213,23 +7213,46 @@ static LeptrisDocument html_parse_shared(
|
|
|
7213
7213
|
continue;
|
|
7214
7214
|
}
|
|
7215
7215
|
|
|
7216
|
-
/*
|
|
7217
|
-
*
|
|
7218
|
-
*
|
|
7219
|
-
*
|
|
7216
|
+
/* Table-structure-only start tags in body drop - "in
|
|
7217
|
+
* body" has no insertion rule for caption, col, colgroup,
|
|
7218
|
+
* head, tbody, td, tfoot, th, thead, tr (WHATWG 13.2.6.4
|
|
7219
|
+
* "any other start tag" path: parse error, ignore the
|
|
7220
|
+
* token, its content flows into body; tests25:7
|
|
7221
|
+
* <body><col>A keeps just "A", tests1:109's trailing
|
|
7222
|
+
* <colgroup> after </table> vanishes). Valid inside a
|
|
7223
|
+
* table/colgroup/template context - the in-table machinery
|
|
7224
|
+
* owns them there. */
|
|
7220
7225
|
if (b.whatwg &&
|
|
7221
7226
|
(strcmp(name, "col") == 0 ||
|
|
7222
|
-
strcmp(name, "colgroup") == 0
|
|
7223
|
-
|
|
7227
|
+
strcmp(name, "colgroup") == 0 ||
|
|
7228
|
+
strcmp(name, "caption") == 0 ||
|
|
7229
|
+
strcmp(name, "head") == 0 ||
|
|
7230
|
+
strcmp(name, "tbody") == 0 ||
|
|
7231
|
+
strcmp(name, "td") == 0 ||
|
|
7232
|
+
strcmp(name, "tfoot") == 0 ||
|
|
7233
|
+
strcmp(name, "th") == 0 ||
|
|
7234
|
+
strcmp(name, "thead") == 0 ||
|
|
7235
|
+
strcmp(name, "tr") == 0)) {
|
|
7236
|
+
/* Foreign content inserts any start tag (the svg/math
|
|
7237
|
+
* breakout list does not include these names) — the
|
|
7238
|
+
* drop is an "in body" rule only. */
|
|
7239
|
+
int tbl_ctx = h_top_foreign(&b) ? 1 : 0;
|
|
7224
7240
|
for (size_t d2 = b.depth; d2 > 0; d2--) {
|
|
7225
7241
|
uint8_t oid2 = b.open_id[d2 - 1];
|
|
7226
7242
|
if (oid2 == h_id_table || oid2 == h_id_colgroup ||
|
|
7227
7243
|
oid2 == h_id_template) {
|
|
7228
|
-
|
|
7244
|
+
tbl_ctx = 1;
|
|
7229
7245
|
break;
|
|
7230
7246
|
}
|
|
7231
7247
|
}
|
|
7232
|
-
if (!
|
|
7248
|
+
if (!tbl_ctx) {
|
|
7249
|
+
/* The TOKEN is ignored - surrounding character
|
|
7250
|
+
* tokens keep flowing into body (the html-merge
|
|
7251
|
+
* flush pattern). */
|
|
7252
|
+
if (text < p) {
|
|
7253
|
+
LeptrisTextNode* t = h_text_node(&b, text, p);
|
|
7254
|
+
if (t) h_append(&b, (LeptrisNodeRef)t);
|
|
7255
|
+
}
|
|
7233
7256
|
while (q < end && *q != '>') q++;
|
|
7234
7257
|
p = (q < end) ? q + 1 : end;
|
|
7235
7258
|
text = p;
|
|
@@ -48,6 +48,7 @@ SerializeBuffer* buffer_create(int indent_spaces) {
|
|
|
48
48
|
buf->indent_spaces = indent_spaces;
|
|
49
49
|
buf->indent_unit = NULL; /* #633: callers opt in per unit string */
|
|
50
50
|
buf->html_method = 0;
|
|
51
|
+
buf->indent_html = 0;
|
|
51
52
|
buf->indent_text = 0;
|
|
52
53
|
buf->expand_empty = 0;
|
|
53
54
|
buf->at_line_start = 0;
|
|
@@ -135,9 +136,11 @@ void buffer_append_char(SerializeBuffer* buf, char c) {
|
|
|
135
136
|
|
|
136
137
|
void buffer_append_indent(SerializeBuffer* buf) {
|
|
137
138
|
if (!buf || buf->indent_spaces <= 0) return;
|
|
138
|
-
/* §16.2 html method: newline-only
|
|
139
|
-
* never nests
|
|
140
|
-
|
|
139
|
+
/* §16.2 html method: the historical layout is newline-only —
|
|
140
|
+
* libxml2's unindented HTML dump never nests. #1635
|
|
141
|
+
* indent_html opts the html method into the nesting layout
|
|
142
|
+
* (htmlNodeDumpFormatOutput format=1). */
|
|
143
|
+
if (buf->html_method && !buf->indent_html) return;
|
|
141
144
|
|
|
142
145
|
if (buf->indent_unit && buf->indent_unit[0]) {
|
|
143
146
|
size_t ul = strlen(buf->indent_unit);
|
|
@@ -1015,7 +1018,8 @@ void serialize_element_internal(LeptrisElement root_elem, SerializeBuffer* buf,
|
|
|
1015
1018
|
* inside a mixed parent is verbatim content: never
|
|
1016
1019
|
* dropped. HTML mode prints text verbatim (libxml2 has
|
|
1017
1020
|
* no formatter-owned whitespace there). */
|
|
1018
|
-
if (buf->indent_spaces > 0 &&
|
|
1021
|
+
if (buf->indent_spaces > 0 &&
|
|
1022
|
+
(!buf->html_method || buf->indent_html) &&
|
|
1019
1023
|
cur->type == LEPTRIS_NODE_TYPE_TEXT &&
|
|
1020
1024
|
!((sp > 0) && st[sp - 1].mixed)) {
|
|
1021
1025
|
LeptrisTextNode* wsn = (LeptrisTextNode*)cur;
|
|
@@ -1102,7 +1106,7 @@ void serialize_element_internal(LeptrisElement root_elem, SerializeBuffer* buf,
|
|
|
1102
1106
|
* line, like element siblings. Mixed-content parents
|
|
1103
1107
|
* keep them inline — a PI between text must not move. */
|
|
1104
1108
|
if (buf->indent_spaces > 0 && sp > 0 && !st[sp - 1].mixed &&
|
|
1105
|
-
!buf->html_method &&
|
|
1109
|
+
(!buf->html_method || buf->indent_html) &&
|
|
1106
1110
|
(cur->type == LEPTRIS_NODE_TYPE_COMMENT ||
|
|
1107
1111
|
cur->type == LEPTRIS_NODE_TYPE_PI)) {
|
|
1108
1112
|
buffer_append_indent(buf);
|
|
@@ -1183,8 +1187,8 @@ void serialize_element_internal(LeptrisElement root_elem, SerializeBuffer* buf,
|
|
|
1183
1187
|
* close into the same single reservation — leaves
|
|
1184
1188
|
* otherwise pay ~8 capacity-checked appends each
|
|
1185
1189
|
* (the raw-only guard was why pretty trailed). */
|
|
1186
|
-
int pretty0 = buf->indent_spaces > 0 &&
|
|
1187
|
-
!buf->html_method
|
|
1190
|
+
int pretty0 = buf->indent_spaces > 0 && !parent_mixed &&
|
|
1191
|
+
(!buf->html_method || buf->indent_html);
|
|
1188
1192
|
/* HTML mode: zero lead ever; trail follows the
|
|
1189
1193
|
* after-close break rule (mixed is not a gate). */
|
|
1190
1194
|
int htrail0 = buf->html_method && !is_root_cur &&
|
|
@@ -1619,12 +1623,32 @@ void serialize_element_internal(LeptrisElement root_elem, SerializeBuffer* buf,
|
|
|
1619
1623
|
int mixed = 0;
|
|
1620
1624
|
int close_brk = 0;
|
|
1621
1625
|
if (buf->html_method) {
|
|
1622
|
-
/* §16.2: mixed is not a gate — the site rules own the
|
|
1623
|
-
* newlines. mixed=1 keeps ws-only text verbatim. */
|
|
1624
|
-
mixed = 1;
|
|
1625
1626
|
int hf = html_elem_sem_flags(e);
|
|
1626
|
-
if (
|
|
1627
|
-
|
|
1627
|
+
if (!buf->indent_html) {
|
|
1628
|
+
/* §16.2 legacy: mixed is not a gate — the site
|
|
1629
|
+
* rules own the newlines. mixed=1 keeps ws-only
|
|
1630
|
+
* text verbatim. */
|
|
1631
|
+
mixed = 1;
|
|
1632
|
+
if (html_break_before_children(e, name, nl, hf))
|
|
1633
|
+
buffer_append_newline(buf);
|
|
1634
|
+
} else {
|
|
1635
|
+
/* #1635 indented HTML: the element takes the block
|
|
1636
|
+
* layout — mixed follows actual text children like
|
|
1637
|
+
* the XML formatter (libxml2 format mode), so the
|
|
1638
|
+
* layout machinery nests; the site rules still own
|
|
1639
|
+
* the newlines. Elements that keep their children
|
|
1640
|
+
* inline (single-child rule) own no whitespace. */
|
|
1641
|
+
int brk_bc = html_break_before_children(e, name, nl, hf);
|
|
1642
|
+
if (brk_bc) {
|
|
1643
|
+
mixed = buf->ws_mixed
|
|
1644
|
+
? ser_children_have_any_text(fc)
|
|
1645
|
+
: ser_children_have_text(fc);
|
|
1646
|
+
if (!mixed && sp > 0 && st[sp - 1].mixed) mixed = 1;
|
|
1647
|
+
} else {
|
|
1648
|
+
mixed = 1;
|
|
1649
|
+
}
|
|
1650
|
+
if (brk_bc) buffer_append_newline(buf);
|
|
1651
|
+
}
|
|
1628
1652
|
close_brk = html_break_before_close(e, name, nl, hf);
|
|
1629
1653
|
} else {
|
|
1630
1654
|
/* #129 indent_text: the formatter owns ALL whitespace —
|
|
@@ -1698,8 +1722,19 @@ void serialize_element_internal(LeptrisElement root_elem, SerializeBuffer* buf,
|
|
|
1698
1722
|
const char* pfx2 = leptris_element_get_prefix(pe);
|
|
1699
1723
|
/* #534: no indent inside a mixed-content element. HTML
|
|
1700
1724
|
* mode: site-3 newline before the close tag, no spaces. */
|
|
1701
|
-
if (buf->html_method) {
|
|
1725
|
+
if (buf->html_method && !buf->indent_html) {
|
|
1702
1726
|
if (st[sp].close_brk) buffer_append_newline(buf);
|
|
1727
|
+
} else if (buf->html_method) {
|
|
1728
|
+
/* #1635: the last child's after-close break may
|
|
1729
|
+
* already have ended the line — dedup so the close
|
|
1730
|
+
* tag nests without a blank line. */
|
|
1731
|
+
if (st[sp].close_brk && buf->size > 0 &&
|
|
1732
|
+
buf->data[buf->size - 1] == '\n') {
|
|
1733
|
+
buffer_append_indent(buf);
|
|
1734
|
+
} else if (st[sp].close_brk) {
|
|
1735
|
+
buffer_append_newline(buf);
|
|
1736
|
+
buffer_append_indent(buf);
|
|
1737
|
+
}
|
|
1703
1738
|
} else if (buf->indent_spaces > 0 && !st[sp].mixed) {
|
|
1704
1739
|
buffer_append_indent(buf);
|
|
1705
1740
|
}
|
|
@@ -1891,6 +1926,9 @@ LEPTRIS_API char* leptris_document_serialize_ext_sized(
|
|
|
1891
1926
|
if (ext_size >= offsetof(LeptrisSerializeExtOptions, html_method) +
|
|
1892
1927
|
sizeof(int))
|
|
1893
1928
|
internal.html_method = ext->html_method;
|
|
1929
|
+
if (ext_size >= offsetof(LeptrisSerializeExtOptions, indent_html) +
|
|
1930
|
+
sizeof(int))
|
|
1931
|
+
internal.indent_html = ext->indent_html;
|
|
1894
1932
|
}
|
|
1895
1933
|
return leptris_document_serialize_ex(doc, options, &internal);
|
|
1896
1934
|
}
|
|
@@ -1926,6 +1964,9 @@ LEPTRIS_API char* leptris_element_serialize_ext_sized(
|
|
|
1926
1964
|
if (ext_size >= offsetof(LeptrisSerializeExtOptions, html_method) +
|
|
1927
1965
|
sizeof(int))
|
|
1928
1966
|
internal.html_method = ext->html_method;
|
|
1967
|
+
if (ext_size >= offsetof(LeptrisSerializeExtOptions, indent_html) +
|
|
1968
|
+
sizeof(int))
|
|
1969
|
+
internal.indent_html = ext->indent_html;
|
|
1929
1970
|
}
|
|
1930
1971
|
return leptris_element_serialize_ex(elem, options, &internal);
|
|
1931
1972
|
}
|
|
@@ -1946,6 +1987,7 @@ char* leptris_element_serialize_ex(LeptrisElement elem,
|
|
|
1946
1987
|
buf->cdata_names = extended->cdata_elements;
|
|
1947
1988
|
buf->cdata_count = extended->cdata_element_count;
|
|
1948
1989
|
buf->html_method = extended->html_method != 0;
|
|
1990
|
+
buf->indent_html = extended->indent_html != 0;
|
|
1949
1991
|
buf->indent_text = extended->indent_text != 0;
|
|
1950
1992
|
buf->expand_empty = extended->expand_empty != 0;
|
|
1951
1993
|
buf->indent_unit = extended->indent_unit;
|
|
@@ -2010,6 +2052,7 @@ char* leptris_document_serialize_ex(struct leptris_document* doc,
|
|
|
2010
2052
|
* force XML (Nokogiri's to_xml-on-HTML-doc). */
|
|
2011
2053
|
if (extended->html_method == -1) buf->html_method = 0;
|
|
2012
2054
|
else if (extended->html_method == 1) buf->html_method = 1;
|
|
2055
|
+
buf->indent_html = extended->indent_html != 0;
|
|
2013
2056
|
buf->indent_text = extended->indent_text != 0;
|
|
2014
2057
|
buf->expand_empty = extended->expand_empty != 0;
|
|
2015
2058
|
buf->indent_unit = extended->indent_unit;
|
|
@@ -77,6 +77,9 @@ typedef struct SerializeBuffer {
|
|
|
77
77
|
/* §16.2 method="html": newline-per-block-element layout governed
|
|
78
78
|
* by the HTML element table (html_elem_flags). */
|
|
79
79
|
int html_method;
|
|
80
|
+
/* #1635: html layout nests with the indent machinery (0 = the
|
|
81
|
+
* §16.2 newline-only shape). */
|
|
82
|
+
int indent_html;
|
|
80
83
|
/* libxml2 XHTML serialization (xmlsave.c xhtmlNodeDumpOutput
|
|
81
84
|
* parity): an xml-method result whose doctype ids match an XHTML
|
|
82
85
|
* DTD injects the Content-Type meta into the root html/head and
|
|
@@ -138,6 +141,7 @@ typedef struct {
|
|
|
138
141
|
/* Indent unit string (#633): one copy per depth level; NULL =
|
|
139
142
|
* indent_spaces spaces per level. */
|
|
140
143
|
const char* indent_unit;
|
|
144
|
+
int indent_html; /* #1635: nested html indent (§16.2 default 0) */
|
|
141
145
|
} LeptrisSerializeExtended;
|
|
142
146
|
|
|
143
147
|
LEPTRIS_API char* leptris_document_serialize_ext(
|
|
@@ -86,6 +86,38 @@ static void verrf(struct xsd_validator* v, const char* what,
|
|
|
86
86
|
verr_push(v, buf);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/* leptris-ruby#419: instance-side errors carry the owning element
|
|
90
|
+
* and its source position (libxml2/Nokogiri shape). The element's
|
|
91
|
+
* own name rides the prefix; the position comes from the recorded
|
|
92
|
+
* source stamp (0 = unlocated — a skipped-positions parse). */
|
|
93
|
+
static void verrf_at(struct xsd_validator* v, LeptrisElement elem,
|
|
94
|
+
const char* what, const char* name,
|
|
95
|
+
const char* detail) {
|
|
96
|
+
char buf[320];
|
|
97
|
+
const char* el = NULL;
|
|
98
|
+
leptris_element_expanded_name(elem, &el, NULL, NULL);
|
|
99
|
+
if (!el) el = "?";
|
|
100
|
+
int line = 0, col = 0;
|
|
101
|
+
{
|
|
102
|
+
LeptrisSourcePosition pos;
|
|
103
|
+
leptris_node_source_position((LeptrisNodeRef)elem, &pos);
|
|
104
|
+
line = pos.line;
|
|
105
|
+
col = pos.col_start;
|
|
106
|
+
}
|
|
107
|
+
int w;
|
|
108
|
+
if (line > 0)
|
|
109
|
+
w = snprintf(buf, sizeof(buf),
|
|
110
|
+
"element '%s' @%d:%d: %s '%s': %s", el, line,
|
|
111
|
+
col, what, name ? name : "?",
|
|
112
|
+
detail ? detail : "invalid");
|
|
113
|
+
else
|
|
114
|
+
w = snprintf(buf, sizeof(buf), "element '%s': %s '%s': %s",
|
|
115
|
+
el, what, name ? name : "?",
|
|
116
|
+
detail ? detail : "invalid");
|
|
117
|
+
(void)w;
|
|
118
|
+
verr_push(v, buf);
|
|
119
|
+
}
|
|
120
|
+
|
|
89
121
|
/* ---- lexical helpers ---------------------------------------------- */
|
|
90
122
|
|
|
91
123
|
static int simple_is_numeric(struct leptris_xsd_schema* s,
|
|
@@ -106,7 +138,12 @@ static int text_valid(struct xsd_validator* v,
|
|
|
106
138
|
r = xsd_simple_valid_chain(s, st, lexical);
|
|
107
139
|
}
|
|
108
140
|
if (r == 0) {
|
|
109
|
-
|
|
141
|
+
if (elem)
|
|
142
|
+
verrf_at(v, elem, what, name,
|
|
143
|
+
"lexical value does not match its type");
|
|
144
|
+
else
|
|
145
|
+
verrf(v, what, name,
|
|
146
|
+
"lexical value does not match its type");
|
|
110
147
|
return 0;
|
|
111
148
|
}
|
|
112
149
|
/* XSD 1.1 xs:assertion facet (document validation only):
|
|
@@ -255,7 +292,7 @@ static void validate_children(struct xsd_validator* v,
|
|
|
255
292
|
? "children do not match the content model (at '%s')"
|
|
256
293
|
: "children do not match the content model",
|
|
257
294
|
culprit ? culprit : "");
|
|
258
|
-
|
|
295
|
+
verrf_at(v, elem, "element", local, msg);
|
|
259
296
|
free(names);
|
|
260
297
|
free(uris);
|
|
261
298
|
}
|
|
@@ -384,13 +421,14 @@ static void validate_attributes(struct xsd_validator* v,
|
|
|
384
421
|
}
|
|
385
422
|
if (!val) {
|
|
386
423
|
if (a->required)
|
|
387
|
-
|
|
424
|
+
verrf_at(v, elem, "attribute", a->name,
|
|
425
|
+
"required but absent");
|
|
388
426
|
continue;
|
|
389
427
|
}
|
|
390
428
|
text_valid(v, s, a->type, val, "attribute", a->name, elem);
|
|
391
429
|
if (a->fixed && strcmp(val, a->fixed) != 0)
|
|
392
|
-
|
|
393
|
-
|
|
430
|
+
verrf_at(v, elem, "attribute", a->name,
|
|
431
|
+
"value does not match the fixed value");
|
|
394
432
|
}
|
|
395
433
|
/* strict: every instance attribute must be declared (or pass
|
|
396
434
|
* the type's xs:anyAttribute grammar). Namespace declarations
|
|
@@ -416,7 +454,8 @@ static void validate_attributes(struct xsd_validator* v,
|
|
|
416
454
|
xsd_target_ns(s)))
|
|
417
455
|
continue;
|
|
418
456
|
}
|
|
419
|
-
|
|
457
|
+
verrf_at(v, elem, "attribute", local,
|
|
458
|
+
"not declared (strict)");
|
|
420
459
|
}
|
|
421
460
|
}
|
|
422
461
|
|
|
@@ -431,7 +470,7 @@ static void validate_element(struct xsd_validator* v,
|
|
|
431
470
|
if (!d) {
|
|
432
471
|
/* strict: the instance uses an element the schema never
|
|
433
472
|
* declared (a local particle would have typed it) */
|
|
434
|
-
|
|
473
|
+
verrf_at(v, elem, "element", local, "not declared (strict)");
|
|
435
474
|
return;
|
|
436
475
|
}
|
|
437
476
|
|
|
@@ -510,7 +549,8 @@ static void validate_local(struct xsd_validator* v,
|
|
|
510
549
|
}
|
|
511
550
|
/* neither complex nor simple nor builtin: the schema is
|
|
512
551
|
* incomplete — loud, never a silent accept (#1615 class) */
|
|
513
|
-
|
|
552
|
+
verrf_at(v, elem, "element", local,
|
|
553
|
+
"type not found in the schema");
|
|
514
554
|
}
|
|
515
555
|
|
|
516
556
|
/* ---- slice 6: identity constraints -------------------------------- */
|
|
@@ -760,6 +760,99 @@ TEST(SerializeOptions, IndentUnitOnTextBearingLeaves) {
|
|
|
760
760
|
leptris_document_free(doc);
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
+
/* Issue #1635: indent_html — the html-method layout nests with
|
|
764
|
+
* the indent machinery (libxml2 htmlNodeDumpFormatOutput format=1):
|
|
765
|
+
* leads before block children and close tags, single-child
|
|
766
|
+
* elements stay inline, raw text verbatim. The §16.2 default
|
|
767
|
+
* (XSLT method="html") stays newline-only. */
|
|
768
|
+
static char* html_force_serialize(LeptrisDocument doc, int indent,
|
|
769
|
+
int indent_html, int ext_bytes) {
|
|
770
|
+
LeptrisSerializeOptions opts = {0};
|
|
771
|
+
opts.indent = indent;
|
|
772
|
+
opts.xml_declaration = 0;
|
|
773
|
+
LeptrisSerializeExtOptions ext = {0};
|
|
774
|
+
ext.html_method = 1;
|
|
775
|
+
ext.indent_html = indent_html;
|
|
776
|
+
return leptris_document_serialize_ext_sized(
|
|
777
|
+
doc, &opts, &ext,
|
|
778
|
+
ext_bytes > 0 ? (size_t)ext_bytes : sizeof(ext));
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
TEST(SerializeOptions, IndentHtmlNestsBlockChildren) {
|
|
782
|
+
const char xml[] = "<html><head><title>T</title></head><body>"
|
|
783
|
+
"<div id=\"a\"><p>x</p><span>y</span></div>"
|
|
784
|
+
"<script>if (a < b) { c(); }</script></body></html>";
|
|
785
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
786
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
787
|
+
ASSERT_NE(doc, nullptr);
|
|
788
|
+
char* s = html_force_serialize(doc, 2, 1, 0);
|
|
789
|
+
ASSERT_NE(s, nullptr);
|
|
790
|
+
EXPECT_EQ(std::string(s),
|
|
791
|
+
"<html>\n"
|
|
792
|
+
" <head><title>T</title></head>\n"
|
|
793
|
+
" <body>\n"
|
|
794
|
+
" <div id=\"a\">\n"
|
|
795
|
+
" <p>x</p>\n"
|
|
796
|
+
" <span>y</span>\n"
|
|
797
|
+
" </div>\n"
|
|
798
|
+
" <script>if (a < b) { c(); }</script>\n"
|
|
799
|
+
" </body>\n"
|
|
800
|
+
"</html>");
|
|
801
|
+
leptris_free_string(s);
|
|
802
|
+
leptris_document_free(doc);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
TEST(SerializeOptions, IndentHtmlLegacyStaysNewlineOnly) {
|
|
806
|
+
const char xml[] = "<html><body><div><p>one</p><p>two</p></div>"
|
|
807
|
+
"</body></html>";
|
|
808
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
809
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
810
|
+
ASSERT_NE(doc, nullptr);
|
|
811
|
+
char* s = html_force_serialize(doc, 2, 0, 0);
|
|
812
|
+
ASSERT_NE(s, nullptr);
|
|
813
|
+
/* §16.2 byte shape: site-rule newlines, never a space lead —
|
|
814
|
+
* single-child wrappers (html>body>div) keep the inline chain,
|
|
815
|
+
* only multi-child blocks break. */
|
|
816
|
+
EXPECT_EQ(std::string(s),
|
|
817
|
+
"<html><body><div>\n"
|
|
818
|
+
"<p>one</p>\n"
|
|
819
|
+
"<p>two</p>\n"
|
|
820
|
+
"</div></body></html>");
|
|
821
|
+
leptris_free_string(s);
|
|
822
|
+
leptris_document_free(doc);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
TEST(SerializeOptions, IndentHtmlNotReadPastCallerLayout) {
|
|
826
|
+
/* #644 shape: a caller compiled against the pre-#1635 layout
|
|
827
|
+
* covers exactly through html_method (24 bytes) — the appended
|
|
828
|
+
* field stays zeroed and the output keeps the legacy shape. */
|
|
829
|
+
const char xml[] = "<html><body><div><p>x</p></div></body></html>";
|
|
830
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
831
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
832
|
+
ASSERT_NE(doc, nullptr);
|
|
833
|
+
const size_t legacy_size =
|
|
834
|
+
offsetof(LeptrisSerializeExtOptions, html_method) + sizeof(int);
|
|
835
|
+
unsigned char raw[64];
|
|
836
|
+
memset(raw, 0x5A, sizeof(raw));
|
|
837
|
+
LeptrisSerializeExtOptions* ext = (LeptrisSerializeExtOptions*)raw;
|
|
838
|
+
ext->indent_text = 0;
|
|
839
|
+
ext->indent_unit = nullptr;
|
|
840
|
+
ext->expand_empty = 0;
|
|
841
|
+
ext->html_method = 1;
|
|
842
|
+
LeptrisSerializeOptions opts = {0};
|
|
843
|
+
opts.indent = 2;
|
|
844
|
+
opts.xml_declaration = 0;
|
|
845
|
+
char* s = leptris_document_serialize_ext_sized(
|
|
846
|
+
doc, &opts, ext, legacy_size);
|
|
847
|
+
ASSERT_NE(s, nullptr);
|
|
848
|
+
char* want = html_force_serialize(doc, 2, 0, 0);
|
|
849
|
+
ASSERT_NE(want, nullptr);
|
|
850
|
+
EXPECT_EQ(std::string(s), std::string(want));
|
|
851
|
+
leptris_free_string(s);
|
|
852
|
+
leptris_free_string(want);
|
|
853
|
+
leptris_document_free(doc);
|
|
854
|
+
}
|
|
855
|
+
|
|
763
856
|
/* Issue #644: FFI callers allocate only the fields they know — the
|
|
764
857
|
* sized entry must not read past their buffer. The Ruby binding's
|
|
765
858
|
* layout is exactly one int (indent_text): a 4-byte ext with garbage
|
|
@@ -1624,3 +1624,62 @@ TEST(XsdImport1626, MisorderReportsOnceNamed) {
|
|
|
1624
1624
|
}
|
|
1625
1625
|
|
|
1626
1626
|
} // namespace
|
|
1627
|
+
|
|
1628
|
+
// ---- leptris-ruby#419: error context (element + location) -------
|
|
1629
|
+
namespace {
|
|
1630
|
+
|
|
1631
|
+
TEST(XsdErrorContext, AttributeErrorCarriesElementAndPosition) {
|
|
1632
|
+
const char* x =
|
|
1633
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1634
|
+
"<xs:complexType name=\"CT_PgMar\">"
|
|
1635
|
+
"<xs:attribute name=\"header\" type=\"xs:integer\""
|
|
1636
|
+
" use=\"required\"/>"
|
|
1637
|
+
"<xs:attribute name=\"gutter\" type=\"xs:integer\""
|
|
1638
|
+
" use=\"required\"/>"
|
|
1639
|
+
"</xs:complexType>"
|
|
1640
|
+
"<xs:element name=\"pgMar\" type=\"CT_PgMar\"/>"
|
|
1641
|
+
"</xs:schema>";
|
|
1642
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1643
|
+
LeptrisXsdSchema s = leptris_xsd_compile(x, strlen(x), &st);
|
|
1644
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
1645
|
+
const char* doc =
|
|
1646
|
+
"\n <pgMar/>\n";
|
|
1647
|
+
LeptrisDocument d = leptris_parse_string(doc, strlen(doc), &st);
|
|
1648
|
+
ASSERT_NE(d, nullptr);
|
|
1649
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 0);
|
|
1650
|
+
size_t n = leptris_xsd_error_count(s);
|
|
1651
|
+
ASSERT_GE(n, 1u);
|
|
1652
|
+
const char* e = leptris_xsd_error_at(s, 0);
|
|
1653
|
+
ASSERT_NE(e, nullptr);
|
|
1654
|
+
EXPECT_NE(strstr(e, "pgMar"), nullptr) << e;
|
|
1655
|
+
EXPECT_NE(strstr(e, "@2:"), nullptr) << e;
|
|
1656
|
+
leptris_document_free(d);
|
|
1657
|
+
leptris_xsd_free(s);
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
TEST(XsdErrorContext, ContentModelErrorCarriesPosition) {
|
|
1661
|
+
const char* x =
|
|
1662
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1663
|
+
"<xs:complexType name=\"T\">"
|
|
1664
|
+
"<xs:sequence>"
|
|
1665
|
+
"<xs:element name=\"a\" type=\"xs:token\"/>"
|
|
1666
|
+
"<xs:element name=\"b\" type=\"xs:token\"/>"
|
|
1667
|
+
"</xs:sequence>"
|
|
1668
|
+
"</xs:complexType>"
|
|
1669
|
+
"<xs:element name=\"r\" type=\"T\"/>"
|
|
1670
|
+
"</xs:schema>";
|
|
1671
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1672
|
+
LeptrisXsdSchema s = leptris_xsd_compile(x, strlen(x), &st);
|
|
1673
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
1674
|
+
const char* doc = "<r>\n <a/>\n <b/>\n <c/>\n</r>\n";
|
|
1675
|
+
LeptrisDocument d = leptris_parse_string(doc, strlen(doc), &st);
|
|
1676
|
+
ASSERT_NE(d, nullptr);
|
|
1677
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 0);
|
|
1678
|
+
const char* e = leptris_xsd_error_at(s, 0);
|
|
1679
|
+
ASSERT_NE(e, nullptr);
|
|
1680
|
+
EXPECT_NE(strstr(e, "@1:"), nullptr) << e;
|
|
1681
|
+
leptris_document_free(d);
|
|
1682
|
+
leptris_xsd_free(s);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
} // namespace
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.338",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.338.0
|
|
5
5
|
platform: ppc64le-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|