@stll/docx-core 0.40.0 → 0.42.0
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.
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +86 -161
- package/dist/ops/documentOps.d.ts +26 -1
- package/dist/ops/documentOps.js +36 -1
- package/dist/schema/sequenceChildren.js +1 -1
- package/dist/{sequenceChildren-CrMcryEF.js → sequenceChildren-CSn0-1ov.js} +17 -45
- package/dist/streamingXmlParser-GnKxUuw_.js +743 -0
- package/dist/xml/streamingXmlParser.d.ts +109 -0
- package/dist/xml/streamingXmlParser.js +1 -0
- package/dist/xml/xmlNamespaceContext.d.ts +6 -0
- package/dist/xml/xmlNamespaceContext.js +53 -0
- package/dist/xml/xmlResourceLimits.d.ts +107 -0
- package/dist/xml/xmlResourceLimits.js +194 -0
- package/dist/xmlElement-C-vuKoul.d.ts +31 -0
- package/package.json +20 -5
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import { EMPTY_NAMESPACE_SCOPE, attachXmlNamespaceContext } from "./xml/xmlNamespaceContext.js";
|
|
2
|
+
import { FOLIO_XML_RESOURCE_LIMITS } from "./xml/xmlResourceLimits.js";
|
|
3
|
+
import { TaggedError } from "better-result";
|
|
4
|
+
// src/serialize/numericIdNames.ts
|
|
5
|
+
/**
|
|
6
|
+
* The attribute and element names that carry OOXML numeric identities.
|
|
7
|
+
*
|
|
8
|
+
* Kept apart from `numericIds.ts` so the XML reader can retain identity
|
|
9
|
+
* attributes during a scan without importing the validator that reads parts
|
|
10
|
+
* with it.
|
|
11
|
+
*/
|
|
12
|
+
const NUMBERING_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
13
|
+
"numId",
|
|
14
|
+
"abstractNumId",
|
|
15
|
+
"numPicBulletId"
|
|
16
|
+
]);
|
|
17
|
+
const ID_VALUE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
18
|
+
"id",
|
|
19
|
+
"numId",
|
|
20
|
+
"abstractNumId",
|
|
21
|
+
"lvlPicBulletId"
|
|
22
|
+
]);
|
|
23
|
+
const localName = (name) => name.slice(name.indexOf(":") + 1);
|
|
24
|
+
/** Attributes an identity scan must retain, derived from the domain classifier. */
|
|
25
|
+
const isOoxmlNumericIdAttributeName = ({ elementName, attributeName }) => {
|
|
26
|
+
const attribute = localName(attributeName);
|
|
27
|
+
return attribute === "id" || NUMBERING_ATTRIBUTES.has(attribute) || attribute === "val" && ID_VALUE_ELEMENTS.has(localName(elementName));
|
|
28
|
+
};
|
|
29
|
+
// src/xml/streamingXmlParser.ts
|
|
30
|
+
/**
|
|
31
|
+
* folio's one XML reader: a single forward pass that builds the shared
|
|
32
|
+
* element tree, or scans start tags without building one.
|
|
33
|
+
*
|
|
34
|
+
* Every reader in the workspace goes through it, and each states how much it
|
|
35
|
+
* accepts:
|
|
36
|
+
*
|
|
37
|
+
* - `ooxml`: the ordinary contract the DOCX readers parse with. The five
|
|
38
|
+
* built-in entities and character references are decoded; a DOCTYPE, any
|
|
39
|
+
* other entity, mismatched or unclosed markup, text outside the root and
|
|
40
|
+
* nesting past {@link FOLIO_XML_RESOURCE_LIMITS} are refused.
|
|
41
|
+
* - `well-formed`: XML 1.0 well-formedness on top of that, for validators. One
|
|
42
|
+
* root element, valid names, no repeated attribute, no `<` in an attribute
|
|
43
|
+
* value, references only to characters XML admits, comments and processing
|
|
44
|
+
* instructions in their lexical form, and no characters XML excludes.
|
|
45
|
+
* - `tolerant`: `ooxml`, except that text outside the root is dropped and a
|
|
46
|
+
* reference the `ooxml` reader refuses is read the way earlier folio
|
|
47
|
+
* releases read it (common HTML names decode, an unknown name stays
|
|
48
|
+
* literal), so a part those releases opened still opens with the same text.
|
|
49
|
+
*
|
|
50
|
+
* `references: "raw"` keeps each reference as written instead of decoding it,
|
|
51
|
+
* for readers that compare or re-emit source spellings.
|
|
52
|
+
*/
|
|
53
|
+
const sourceRanges = /* @__PURE__ */ new WeakMap();
|
|
54
|
+
/** Exact element source ranges, available only from the opt-in source-range reader. */
|
|
55
|
+
const getXmlSourceRange = (element) => sourceRanges.get(element);
|
|
56
|
+
const BUILT_IN_ENTITIES = {
|
|
57
|
+
amp: "&",
|
|
58
|
+
apos: "'",
|
|
59
|
+
gt: ">",
|
|
60
|
+
lt: "<",
|
|
61
|
+
quot: "\""
|
|
62
|
+
};
|
|
63
|
+
const XmlReadErrorBase = TaggedError("XmlReadError");
|
|
64
|
+
/** An XML part the reader refused under the conformance its caller asked for. */
|
|
65
|
+
var XmlReadError = class extends XmlReadErrorBase {};
|
|
66
|
+
const reject = (reason) => ({
|
|
67
|
+
status: "unsupported",
|
|
68
|
+
reason
|
|
69
|
+
});
|
|
70
|
+
const valueReaderFor = ({ conformance, references, undeclaredEntities }) => {
|
|
71
|
+
if (conformance === "tolerant") return references === "decode" ? (value) => decodeTolerantReferences(normalizeLineEndings(value)) : normalizeLineEndings;
|
|
72
|
+
let decodeReference = decodeOoxmlReference;
|
|
73
|
+
if (undeclaredEntities === "accept") decodeReference = decodeReferenceKeepingUndeclared;
|
|
74
|
+
else if (conformance === "well-formed") decodeReference = decodeWellFormedReference;
|
|
75
|
+
return references === "decode" ? (value) => decodeReferences(normalizeLineEndings(value), decodeReference) : (value) => {
|
|
76
|
+
const normalized = normalizeLineEndings(value);
|
|
77
|
+
return decodeReferences(normalized, decodeReference) === null ? null : normalized;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const readRulesFor = (policy) => ({
|
|
81
|
+
conformance: policy.conformance,
|
|
82
|
+
readValue: valueReaderFor(policy),
|
|
83
|
+
validNames: policy.conformance === "well-formed" ? /* @__PURE__ */ new Set() : void 0
|
|
84
|
+
});
|
|
85
|
+
let defaultRules;
|
|
86
|
+
const parseStreamingXmlInternal = (options) => {
|
|
87
|
+
const { xml, inheritedNamespaceScope = EMPTY_NAMESPACE_SCOPE } = options;
|
|
88
|
+
const rules = options.conformance === void 0 && options.references === void 0 && options.undeclaredEntities === void 0 ? defaultRules ??= readRulesFor({
|
|
89
|
+
conformance: "ooxml",
|
|
90
|
+
references: "decode",
|
|
91
|
+
undeclaredEntities: "refuse"
|
|
92
|
+
}) : readRulesFor({
|
|
93
|
+
conformance: options.conformance ?? "ooxml",
|
|
94
|
+
references: options.references ?? "decode",
|
|
95
|
+
undeclaredEntities: options.undeclaredEntities ?? "refuse"
|
|
96
|
+
});
|
|
97
|
+
const wellFormed = rules.conformance === "well-formed";
|
|
98
|
+
const retainInstructions = options.instructions === "retain";
|
|
99
|
+
if (wellFormed && !containsOnlyXmlCharacters(xml)) return reject("a character XML does not allow");
|
|
100
|
+
const visitOpenTag = options.visitOpenTag;
|
|
101
|
+
let spanMode = "none";
|
|
102
|
+
if (visitOpenTag !== void 0) spanMode = options.mode === "tree" ? "identities" : "all";
|
|
103
|
+
if (options.visitElement !== void 0) spanMode = "all";
|
|
104
|
+
const openTagOptions = {
|
|
105
|
+
xml,
|
|
106
|
+
start: 0,
|
|
107
|
+
close: 0,
|
|
108
|
+
spanMode,
|
|
109
|
+
rules,
|
|
110
|
+
retainAttribute: options.mode === "attributes" ? options.retainAttribute : void 0
|
|
111
|
+
};
|
|
112
|
+
const root = { elements: [] };
|
|
113
|
+
const stack = [];
|
|
114
|
+
const replacements = [];
|
|
115
|
+
const documentStart = xml.charCodeAt(0) === 65279 ? 1 : 0;
|
|
116
|
+
let rootElements = 0;
|
|
117
|
+
let cursor = documentStart;
|
|
118
|
+
let mergeAdjacentText = false;
|
|
119
|
+
const acceptText = (text, merge) => {
|
|
120
|
+
if (wellFormed && text.includes("]]>")) return false;
|
|
121
|
+
if (options.mode === "tree") return appendText(text, stack, merge, rules);
|
|
122
|
+
const decoded = rules.readValue(text);
|
|
123
|
+
return decoded !== null && (stack.length > 0 || isXmlWhitespaceText(decoded) || rules.conformance === "tolerant");
|
|
124
|
+
};
|
|
125
|
+
while (cursor < xml.length) {
|
|
126
|
+
const open = xml.indexOf("<", cursor);
|
|
127
|
+
if (open === -1) {
|
|
128
|
+
if (!acceptText(xml.slice(cursor), mergeAdjacentText)) return reject("text the reader does not accept");
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
if (open > cursor && !acceptText(xml.slice(cursor, open), mergeAdjacentText)) return reject("text the reader does not accept");
|
|
132
|
+
if (open > cursor) mergeAdjacentText = true;
|
|
133
|
+
if (xml.startsWith("<!--", open)) {
|
|
134
|
+
const close = xml.indexOf("-->", open + 4);
|
|
135
|
+
if (close === -1) return reject("an unclosed comment");
|
|
136
|
+
if (wellFormed) {
|
|
137
|
+
const body = xml.slice(open + 4, close);
|
|
138
|
+
if (body.includes("--") || body.endsWith("-")) return reject("a comment containing --");
|
|
139
|
+
}
|
|
140
|
+
cursor = close + 3;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (xml.startsWith("<![CDATA[", open)) {
|
|
144
|
+
const close = xml.indexOf("]]>", open + 9);
|
|
145
|
+
if (close === -1) return reject("an unclosed CDATA section");
|
|
146
|
+
if (wellFormed && stack.length === 0) return reject("a CDATA section outside the root element");
|
|
147
|
+
const text = normalizeLineEndings(xml.slice(open + 9, close));
|
|
148
|
+
if (!(options.mode === "tree" ? appendRawText(text, stack, rules) : stack.length > 0 || isXmlWhitespaceText(text) || rules.conformance === "tolerant")) return reject("text outside the root element");
|
|
149
|
+
cursor = close + 3;
|
|
150
|
+
mergeAdjacentText = false;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (xml.startsWith("<?", open)) {
|
|
154
|
+
const close = xml.indexOf("?>", open + 2);
|
|
155
|
+
if (close === -1) return reject("an unclosed processing instruction");
|
|
156
|
+
const instruction = readInstruction(xml, open, close);
|
|
157
|
+
if (wellFormed) {
|
|
158
|
+
const issue = instructionIssue({
|
|
159
|
+
instruction,
|
|
160
|
+
open,
|
|
161
|
+
documentStart,
|
|
162
|
+
rules
|
|
163
|
+
});
|
|
164
|
+
if (issue !== null) return reject(issue);
|
|
165
|
+
}
|
|
166
|
+
if (retainInstructions && options.mode === "tree") appendElement(stack.at(-1)?.element ?? root, {
|
|
167
|
+
type: "instruction",
|
|
168
|
+
name: instruction.target,
|
|
169
|
+
instruction: instruction.body
|
|
170
|
+
});
|
|
171
|
+
cursor = close + 2;
|
|
172
|
+
mergeAdjacentText = false;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (xml.startsWith("<!", open)) return reject("a DOCTYPE or markup declaration");
|
|
176
|
+
const close = findTagClose(xml, open + 1);
|
|
177
|
+
if (close === -1) return reject("an unclosed tag");
|
|
178
|
+
if (xml.charCodeAt(open + 1) === 47) {
|
|
179
|
+
if (wellFormed && isXmlWhitespace(xml.charCodeAt(open + 2))) return reject("whitespace before an end-tag name");
|
|
180
|
+
const name = xml.slice(open + 2, close).trim();
|
|
181
|
+
const frame = stack.pop();
|
|
182
|
+
if (!frame || frame.name !== name) return reject("an end tag that does not match its start tag");
|
|
183
|
+
if (frame.start !== void 0) sourceRanges.set(frame.element, {
|
|
184
|
+
start: frame.start,
|
|
185
|
+
end: close + 1
|
|
186
|
+
});
|
|
187
|
+
cursor = close + 1;
|
|
188
|
+
mergeAdjacentText = false;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
openTagOptions.start = open + 1;
|
|
192
|
+
openTagOptions.close = close;
|
|
193
|
+
const parsedTag = parseOpenTag(openTagOptions);
|
|
194
|
+
if (parsedTag.status === "unsupported") return parsedTag;
|
|
195
|
+
if (stack.length === 0) {
|
|
196
|
+
rootElements += 1;
|
|
197
|
+
if (wellFormed && rootElements > 1) return reject("more than one root element");
|
|
198
|
+
}
|
|
199
|
+
const parent = stack.at(-1)?.element;
|
|
200
|
+
const scope = parent?.namespaceScope ?? inheritedNamespaceScope;
|
|
201
|
+
if (options.mode === "verdict") {} else if (options.mode === "attributes" && options.retainAttribute !== void 0 && parsedTag.element.attributes === void 0) parsedTag.element.namespaceScope = scope;
|
|
202
|
+
else attachXmlNamespaceContext(parsedTag.element, scope);
|
|
203
|
+
options.visitElement?.({
|
|
204
|
+
element: parsedTag.element,
|
|
205
|
+
attributeValueSpans: parsedTag.attributeValueSpans ?? /* @__PURE__ */ new Map(),
|
|
206
|
+
nameEnd: parsedTag.nameEnd,
|
|
207
|
+
parent
|
|
208
|
+
});
|
|
209
|
+
const rewritten = (options.mode === "tree" ? parsedTag.attributeValueSpans !== void 0 : options.mode === "attributes" && (options.retainAttribute === void 0 || parsedTag.element.attributes !== void 0)) ? visitOpenTag?.(parsedTag.element, parsedTag.attributeValueSpans ?? /* @__PURE__ */ new Map()) : null;
|
|
210
|
+
if (rewritten) for (const [attributeName, value] of rewritten) {
|
|
211
|
+
const span = parsedTag.attributeValueSpans?.get(attributeName);
|
|
212
|
+
if (!span) return reject("a rewrite of an attribute the tag does not carry");
|
|
213
|
+
replacements.push({
|
|
214
|
+
...span,
|
|
215
|
+
value
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (stack.length >= FOLIO_XML_RESOURCE_LIMITS.maxDepth) return reject(`nesting deeper than ${String(FOLIO_XML_RESOURCE_LIMITS.maxDepth)} elements`);
|
|
219
|
+
if (options.mode === "tree") appendElement(parent ?? root, parsedTag.element);
|
|
220
|
+
if (!parsedTag.selfClosing) stack.push(options.mode === "tree" && options.sourceRanges === "tracked" ? {
|
|
221
|
+
element: parsedTag.element,
|
|
222
|
+
name: parsedTag.name,
|
|
223
|
+
start: open
|
|
224
|
+
} : {
|
|
225
|
+
element: parsedTag.element,
|
|
226
|
+
name: parsedTag.name
|
|
227
|
+
});
|
|
228
|
+
else if (options.mode === "tree" && options.sourceRanges === "tracked") sourceRanges.set(parsedTag.element, {
|
|
229
|
+
start: open,
|
|
230
|
+
end: close + 1
|
|
231
|
+
});
|
|
232
|
+
cursor = close + 1;
|
|
233
|
+
mergeAdjacentText = false;
|
|
234
|
+
}
|
|
235
|
+
if (stack.length > 0) return reject("an unclosed element");
|
|
236
|
+
if (wellFormed && rootElements === 0) return reject("no root element");
|
|
237
|
+
return {
|
|
238
|
+
status: "parsed",
|
|
239
|
+
value: root,
|
|
240
|
+
replacements
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
/** Read `xml` into a tree under the stated conformance, in one pass. */
|
|
244
|
+
const readXml = (xml, { conformance, references = "decode", undeclaredEntities = "refuse", instructions = "skip", inheritedNamespaceScope = EMPTY_NAMESPACE_SCOPE }) => {
|
|
245
|
+
const parsed = parseStreamingXmlInternal({
|
|
246
|
+
xml,
|
|
247
|
+
mode: "tree",
|
|
248
|
+
conformance,
|
|
249
|
+
references,
|
|
250
|
+
undeclaredEntities,
|
|
251
|
+
instructions,
|
|
252
|
+
inheritedNamespaceScope
|
|
253
|
+
});
|
|
254
|
+
return parsed.status === "parsed" ? {
|
|
255
|
+
status: "parsed",
|
|
256
|
+
value: parsed.value
|
|
257
|
+
} : {
|
|
258
|
+
status: "rejected",
|
|
259
|
+
reason: parsed.reason
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* The reason `xml` is not well-formed XML, or `null` when it is.
|
|
264
|
+
*
|
|
265
|
+
* Stricter than XML 1.0 in one respect: an element or attribute named like a
|
|
266
|
+
* built-in object property (`__proto__`, `constructor`, `toString`, ...) is
|
|
267
|
+
* refused even though XML allows the name, because every folio reader keys
|
|
268
|
+
* plain objects by name and refuses it too; a part this accepts is one they
|
|
269
|
+
* can read.
|
|
270
|
+
*/
|
|
271
|
+
const wellFormedXmlIssue = (xml, undeclaredEntities = "refuse") => {
|
|
272
|
+
const parsed = parseStreamingXmlInternal({
|
|
273
|
+
xml,
|
|
274
|
+
mode: "verdict",
|
|
275
|
+
conformance: "well-formed",
|
|
276
|
+
references: "raw",
|
|
277
|
+
undeclaredEntities
|
|
278
|
+
});
|
|
279
|
+
return parsed.status === "parsed" ? null : parsed.reason;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @param inheritedNamespaceScope the bindings in scope around `xml`, for a
|
|
283
|
+
* fragment captured out of a part whose root declared them.
|
|
284
|
+
*/
|
|
285
|
+
const parseStreamingXml = (xml, inheritedNamespaceScope = EMPTY_NAMESPACE_SCOPE) => {
|
|
286
|
+
const parsed = parseStreamingXmlInternal({
|
|
287
|
+
xml,
|
|
288
|
+
mode: "tree",
|
|
289
|
+
inheritedNamespaceScope
|
|
290
|
+
});
|
|
291
|
+
return parsed.status === "parsed" ? {
|
|
292
|
+
status: "parsed",
|
|
293
|
+
value: parsed.value
|
|
294
|
+
} : { status: "unsupported" };
|
|
295
|
+
};
|
|
296
|
+
/** Retain source spans for every element without changing the parsed namespace tree. */
|
|
297
|
+
const parseStreamingXmlWithSourceRanges = (xml, inheritedNamespaceScope = EMPTY_NAMESPACE_SCOPE) => {
|
|
298
|
+
const parsed = parseStreamingXmlInternal({
|
|
299
|
+
xml,
|
|
300
|
+
mode: "tree",
|
|
301
|
+
inheritedNamespaceScope,
|
|
302
|
+
sourceRanges: "tracked"
|
|
303
|
+
});
|
|
304
|
+
return parsed.status === "parsed" ? {
|
|
305
|
+
status: "parsed",
|
|
306
|
+
value: parsed.value
|
|
307
|
+
} : { status: "unsupported" };
|
|
308
|
+
};
|
|
309
|
+
/** Retain the body tree while collecting identities for import repair. */
|
|
310
|
+
const parseStreamingXmlWithIdentityVisitor = (xml, visitOpenTag) => {
|
|
311
|
+
const parsed = parseStreamingXmlInternal({
|
|
312
|
+
xml,
|
|
313
|
+
mode: "tree",
|
|
314
|
+
visitOpenTag
|
|
315
|
+
});
|
|
316
|
+
return parsed.status === "parsed" ? {
|
|
317
|
+
status: "parsed",
|
|
318
|
+
value: parsed.value
|
|
319
|
+
} : { status: "unsupported" };
|
|
320
|
+
};
|
|
321
|
+
/** Rewrite selected decimal attribute values while preserving every other source byte. */
|
|
322
|
+
const rewriteStreamingXmlDecimalAttributes = (xml, visitOpenTag) => {
|
|
323
|
+
const parsed = parseStreamingXmlInternal({
|
|
324
|
+
xml,
|
|
325
|
+
mode: "attributes",
|
|
326
|
+
visitOpenTag
|
|
327
|
+
});
|
|
328
|
+
if (parsed.status === "unsupported") return { status: "unsupported" };
|
|
329
|
+
const chunks = [];
|
|
330
|
+
let cursor = 0;
|
|
331
|
+
for (const replacement of parsed.replacements.toSorted((left, right) => left.start - right.start)) {
|
|
332
|
+
if (!/^\d+$/u.test(replacement.value)) return { status: "unsupported" };
|
|
333
|
+
chunks.push(xml.slice(cursor, replacement.start), replacement.value);
|
|
334
|
+
cursor = replacement.end;
|
|
335
|
+
}
|
|
336
|
+
chunks.push(xml.slice(cursor));
|
|
337
|
+
return {
|
|
338
|
+
status: "rewritten",
|
|
339
|
+
value: chunks.join("")
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
/** Visit identity attributes and namespace bindings without building an XML tree. */
|
|
343
|
+
const scanStreamingXmlNumericIdAttributes = (xml, visitOpenTag) => {
|
|
344
|
+
return parseStreamingXmlInternal({
|
|
345
|
+
xml,
|
|
346
|
+
mode: "attributes",
|
|
347
|
+
visitOpenTag,
|
|
348
|
+
retainAttribute: ({ attributeName, elementName }) => {
|
|
349
|
+
if (attributeName === "xmlns" || attributeName.startsWith("xmlns:")) return true;
|
|
350
|
+
return isOoxmlNumericIdAttributeName({
|
|
351
|
+
elementName,
|
|
352
|
+
attributeName
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}).status === "parsed" ? { status: "scanned" } : { status: "unsupported" };
|
|
356
|
+
};
|
|
357
|
+
/** Visit namespace-resolved start tags and source spans without building a tree. */
|
|
358
|
+
const scanStreamingXmlElements = (xml, visitElement) => {
|
|
359
|
+
return parseStreamingXmlInternal({
|
|
360
|
+
xml,
|
|
361
|
+
mode: "attributes",
|
|
362
|
+
visitOpenTag: () => null,
|
|
363
|
+
visitElement
|
|
364
|
+
}).status === "parsed" ? { status: "scanned" } : { status: "unsupported" };
|
|
365
|
+
};
|
|
366
|
+
const parseOpenTag = ({ xml, start, close, spanMode, rules, retainAttribute }) => {
|
|
367
|
+
const { validNames } = rules;
|
|
368
|
+
if (validNames !== void 0 && isXmlWhitespace(xml.charCodeAt(start))) return reject("whitespace before a start-tag name");
|
|
369
|
+
let cursor = skipWhitespace(xml, start, close);
|
|
370
|
+
const nameStart = cursor;
|
|
371
|
+
cursor = scanName(xml, cursor, close);
|
|
372
|
+
if (cursor === nameStart) return reject("a start tag without a name");
|
|
373
|
+
const name = xml.slice(nameStart, cursor);
|
|
374
|
+
const nameEnd = cursor;
|
|
375
|
+
if (isUnsafePropertyName(name)) return reject(`the reserved name ${name}`);
|
|
376
|
+
if (validNames !== void 0 && !isValidName(name, validNames)) return reject(`the invalid element name ${name}`);
|
|
377
|
+
let attributes;
|
|
378
|
+
let attributeValueSpans;
|
|
379
|
+
let selfClosing = false;
|
|
380
|
+
while (cursor < close) {
|
|
381
|
+
const separated = cursor;
|
|
382
|
+
cursor = skipWhitespace(xml, cursor, close);
|
|
383
|
+
if (cursor >= close) break;
|
|
384
|
+
if (xml.charCodeAt(cursor) === 47) {
|
|
385
|
+
selfClosing = true;
|
|
386
|
+
if (validNames !== void 0 && cursor + 1 !== close) return reject("characters between / and > in an empty-element tag");
|
|
387
|
+
cursor = skipWhitespace(xml, cursor + 1, close);
|
|
388
|
+
if (cursor !== close) return reject("characters after / in a start tag");
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
if (validNames !== void 0 && cursor === separated) return reject("attributes without whitespace between them");
|
|
392
|
+
const attributeNameStart = cursor;
|
|
393
|
+
cursor = scanName(xml, cursor, close);
|
|
394
|
+
if (cursor === attributeNameStart) return reject("an attribute without a name");
|
|
395
|
+
const attributeName = xml.slice(attributeNameStart, cursor);
|
|
396
|
+
if (isUnsafePropertyName(attributeName)) return reject(`the reserved name ${attributeName}`);
|
|
397
|
+
if (validNames !== void 0 && !isValidName(attributeName, validNames)) return reject(`the invalid attribute name ${attributeName}`);
|
|
398
|
+
cursor = skipWhitespace(xml, cursor, close);
|
|
399
|
+
if (xml.charCodeAt(cursor) !== 61) return reject(`the attribute ${attributeName} without a value`);
|
|
400
|
+
cursor = skipWhitespace(xml, cursor + 1, close);
|
|
401
|
+
const quote = xml.charCodeAt(cursor);
|
|
402
|
+
if (quote !== 34 && quote !== 39) return reject(`the unquoted attribute ${attributeName}`);
|
|
403
|
+
const valueStart = cursor + 1;
|
|
404
|
+
cursor = xml.indexOf(quote === 34 ? "\"" : "'", valueStart);
|
|
405
|
+
if (cursor === -1 || cursor > close) return reject(`the unterminated attribute ${attributeName}`);
|
|
406
|
+
const raw = xml.slice(valueStart, cursor);
|
|
407
|
+
if (validNames !== void 0 && raw.includes("<")) return reject(`a < in the attribute ${attributeName}`);
|
|
408
|
+
const decoded = rules.readValue(raw);
|
|
409
|
+
if (decoded === null) return reject(`a reference the reader does not accept in ${attributeName}`);
|
|
410
|
+
if (retainAttribute === void 0 || retainAttribute({
|
|
411
|
+
attributeName,
|
|
412
|
+
elementName: name
|
|
413
|
+
})) {
|
|
414
|
+
attributes ??= {};
|
|
415
|
+
if (validNames !== void 0 && Object.hasOwn(attributes, attributeName)) return reject(`the repeated attribute ${attributeName}`);
|
|
416
|
+
attributes[attributeName] = decoded;
|
|
417
|
+
if (spanMode === "all" || spanMode === "identities" && isOoxmlNumericIdAttributeName({
|
|
418
|
+
elementName: name,
|
|
419
|
+
attributeName
|
|
420
|
+
})) {
|
|
421
|
+
attributeValueSpans ??= /* @__PURE__ */ new Map();
|
|
422
|
+
attributeValueSpans.set(attributeName, {
|
|
423
|
+
start: valueStart,
|
|
424
|
+
end: cursor
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
cursor += 1;
|
|
429
|
+
}
|
|
430
|
+
const element = {
|
|
431
|
+
type: "element",
|
|
432
|
+
name
|
|
433
|
+
};
|
|
434
|
+
if (attributes) element.attributes = attributes;
|
|
435
|
+
return {
|
|
436
|
+
status: "parsed",
|
|
437
|
+
element,
|
|
438
|
+
name,
|
|
439
|
+
nameEnd,
|
|
440
|
+
selfClosing,
|
|
441
|
+
attributeValueSpans
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
const appendElement = (parent, child) => {
|
|
445
|
+
parent.elements ??= [];
|
|
446
|
+
parent.elements.push(child);
|
|
447
|
+
};
|
|
448
|
+
const appendText = (text, stack, mergeAdjacentText, rules) => {
|
|
449
|
+
if (text.length === 0) return true;
|
|
450
|
+
const decoded = rules.readValue(text);
|
|
451
|
+
if (decoded === null) return false;
|
|
452
|
+
const parent = stack.at(-1)?.element;
|
|
453
|
+
const previous = mergeAdjacentText ? parent?.elements?.at(-1) : void 0;
|
|
454
|
+
if (previous?.type === "text" && typeof previous.text === "string") {
|
|
455
|
+
previous.text += decoded;
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
return appendRawText(decoded, stack, rules);
|
|
459
|
+
};
|
|
460
|
+
const appendRawText = (text, stack, rules) => {
|
|
461
|
+
const parent = stack.at(-1)?.element;
|
|
462
|
+
if (!parent) return isXmlWhitespaceText(text) || rules.conformance === "tolerant";
|
|
463
|
+
appendElement(parent, {
|
|
464
|
+
type: "text",
|
|
465
|
+
text
|
|
466
|
+
});
|
|
467
|
+
return true;
|
|
468
|
+
};
|
|
469
|
+
const readInstruction = (xml, open, close) => {
|
|
470
|
+
let targetEnd = open + 2;
|
|
471
|
+
while (targetEnd < close && !isXmlWhitespace(xml.charCodeAt(targetEnd))) targetEnd += 1;
|
|
472
|
+
return {
|
|
473
|
+
target: xml.slice(open + 2, targetEnd),
|
|
474
|
+
body: xml.slice(targetEnd, close).trim()
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
/** XML 1.0 §2.8: a declaration opens with `version="1.<digits>"`. */
|
|
478
|
+
const XML_DECLARATION_VERSION = /^version\s*=\s*(["'])1\.\d+\1(?:\s|$)/u;
|
|
479
|
+
const instructionIssue = ({ instruction: { target, body }, open, documentStart, rules }) => {
|
|
480
|
+
if (!isValidName(target, rules.validNames ?? /* @__PURE__ */ new Set())) return "a processing instruction without a valid target";
|
|
481
|
+
if (target.toLowerCase() !== "xml") return null;
|
|
482
|
+
if (target !== "xml" || open !== documentStart) return "an XML declaration after the start of the document";
|
|
483
|
+
return XML_DECLARATION_VERSION.test(body) ? null : "an XML declaration without a version";
|
|
484
|
+
};
|
|
485
|
+
const findTagClose = (xml, start) => {
|
|
486
|
+
let quote = 0;
|
|
487
|
+
for (let cursor = start; cursor < xml.length; cursor += 1) {
|
|
488
|
+
const code = xml.charCodeAt(cursor);
|
|
489
|
+
if (quote !== 0) {
|
|
490
|
+
if (code === quote) quote = 0;
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
if (code === 34 || code === 39) {
|
|
494
|
+
quote = code;
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
if (code === 62) return cursor;
|
|
498
|
+
}
|
|
499
|
+
return -1;
|
|
500
|
+
};
|
|
501
|
+
const isXmlWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
|
|
502
|
+
/**
|
|
503
|
+
* Whether `text` is only the whitespace XML 1.0 admits outside the root:
|
|
504
|
+
* space, tab, CR and LF. `String.prototype.trim` also strips U+00A0 and
|
|
505
|
+
* other Unicode spaces, which XML does not.
|
|
506
|
+
*/
|
|
507
|
+
const isXmlWhitespaceText = (text) => {
|
|
508
|
+
for (let index = 0; index < text.length; index += 1) if (!isXmlWhitespace(text.charCodeAt(index))) return false;
|
|
509
|
+
return true;
|
|
510
|
+
};
|
|
511
|
+
const skipWhitespace = (xml, start, limit) => {
|
|
512
|
+
let cursor = start;
|
|
513
|
+
while (cursor < limit && isXmlWhitespace(xml.charCodeAt(cursor))) cursor += 1;
|
|
514
|
+
return cursor;
|
|
515
|
+
};
|
|
516
|
+
const scanName = (xml, start, limit) => {
|
|
517
|
+
let cursor = start;
|
|
518
|
+
while (cursor < limit) {
|
|
519
|
+
const code = xml.charCodeAt(cursor);
|
|
520
|
+
if (isXmlWhitespace(code) || code === 47 || code === 61 || code === 62) break;
|
|
521
|
+
cursor += 1;
|
|
522
|
+
}
|
|
523
|
+
return cursor;
|
|
524
|
+
};
|
|
525
|
+
/** XML 1.0 (Fifth Edition) §2.3 `Name`. */
|
|
526
|
+
const NAME_START_CHARACTER = String.raw`:A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}`;
|
|
527
|
+
const NAME_CHARACTER = String.raw`${NAME_START_CHARACTER}\-.0-9\u{B7}\u{300}-\u{36F}\u{203F}-\u{2040}`;
|
|
528
|
+
const XML_NAME = new RegExp(`^[${NAME_START_CHARACTER}][${NAME_CHARACTER}]*$`, "u");
|
|
529
|
+
const isValidName = (name, validNames) => {
|
|
530
|
+
if (validNames.has(name)) return true;
|
|
531
|
+
if (!XML_NAME.test(name)) return false;
|
|
532
|
+
validNames.add(name);
|
|
533
|
+
return true;
|
|
534
|
+
};
|
|
535
|
+
/** XML 1.0 §2.2 `Char`. */
|
|
536
|
+
const isXmlCharacter = (codePoint) => codePoint === 9 || codePoint === 10 || codePoint === 13 || codePoint >= 32 && codePoint <= 55295 || codePoint >= 57344 && codePoint <= 65533 || codePoint >= 65536 && codePoint <= 1114111;
|
|
537
|
+
const containsOnlyXmlCharacters = (xml) => {
|
|
538
|
+
for (let index = 0; index < xml.length; index += 1) {
|
|
539
|
+
const code = xml.charCodeAt(index);
|
|
540
|
+
if (code >= 32 && code < 55296) continue;
|
|
541
|
+
if (code === 9 || code === 10 || code === 13) continue;
|
|
542
|
+
if (code >= 57344 && code <= 65533) continue;
|
|
543
|
+
if (code >= 55296 && code <= 56319) {
|
|
544
|
+
const next = xml.charCodeAt(index + 1);
|
|
545
|
+
if (next >= 56320 && next <= 57343) {
|
|
546
|
+
index += 1;
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
return true;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Decode every reference in `value`; `null` when one is refused.
|
|
556
|
+
*
|
|
557
|
+
* The decoder answers for the text between `&` and `;`, and a `null` there
|
|
558
|
+
* refuses the whole value.
|
|
559
|
+
*/
|
|
560
|
+
const decodeReferences = (value, decodeReference) => {
|
|
561
|
+
const firstEntity = value.indexOf("&");
|
|
562
|
+
if (firstEntity === -1) return value;
|
|
563
|
+
const parts = [];
|
|
564
|
+
let cursor = 0;
|
|
565
|
+
let entityStart = firstEntity;
|
|
566
|
+
while (entityStart !== -1) {
|
|
567
|
+
parts.push(value.slice(cursor, entityStart));
|
|
568
|
+
const entityEnd = value.indexOf(";", entityStart + 1);
|
|
569
|
+
if (entityEnd === -1) return null;
|
|
570
|
+
const decoded = decodeReference(value.slice(entityStart + 1, entityEnd));
|
|
571
|
+
if (decoded === null) return null;
|
|
572
|
+
parts.push(decoded);
|
|
573
|
+
cursor = entityEnd + 1;
|
|
574
|
+
entityStart = value.indexOf("&", cursor);
|
|
575
|
+
}
|
|
576
|
+
parts.push(value.slice(cursor));
|
|
577
|
+
return parts.join("");
|
|
578
|
+
};
|
|
579
|
+
const normalizeLineEndings = (value) => {
|
|
580
|
+
if (!value.includes("\r")) return value;
|
|
581
|
+
return value.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
|
|
582
|
+
};
|
|
583
|
+
const builtInEntity = (entity) => {
|
|
584
|
+
switch (entity) {
|
|
585
|
+
case "amp": return BUILT_IN_ENTITIES.amp;
|
|
586
|
+
case "apos": return BUILT_IN_ENTITIES.apos;
|
|
587
|
+
case "gt": return BUILT_IN_ENTITIES.gt;
|
|
588
|
+
case "lt": return BUILT_IN_ENTITIES.lt;
|
|
589
|
+
case "quot": return BUILT_IN_ENTITIES.quot;
|
|
590
|
+
default: return null;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const parseCharacterReference = (entity) => {
|
|
594
|
+
if (entity.charCodeAt(0) !== 35) return null;
|
|
595
|
+
const marker = entity.charAt(1);
|
|
596
|
+
const hexMarker = marker === "x" || marker === "X" ? marker : null;
|
|
597
|
+
const digits = entity.slice(hexMarker === null ? 1 : 2);
|
|
598
|
+
if (digits.length === 0 || !hasOnlyDigits(digits, hexMarker !== null)) return null;
|
|
599
|
+
return {
|
|
600
|
+
codePoint: Number.parseInt(digits, hexMarker === null ? 10 : 16),
|
|
601
|
+
hexMarker
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
/** The `ooxml` reader's references: the built-ins and any scalar value. */
|
|
605
|
+
const decodeOoxmlReference = (entity) => {
|
|
606
|
+
const builtIn = builtInEntity(entity);
|
|
607
|
+
if (builtIn !== null) return builtIn;
|
|
608
|
+
const reference = parseCharacterReference(entity);
|
|
609
|
+
if (reference === null) return null;
|
|
610
|
+
const { codePoint } = reference;
|
|
611
|
+
if (!Number.isInteger(codePoint) || codePoint <= 0 || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) return null;
|
|
612
|
+
return String.fromCodePoint(codePoint);
|
|
613
|
+
};
|
|
614
|
+
/** XML 1.0 §4.1: `&#x` in lower case, and only characters §2.2 admits. */
|
|
615
|
+
const decodeWellFormedReference = (entity) => {
|
|
616
|
+
const builtIn = builtInEntity(entity);
|
|
617
|
+
if (builtIn !== null) return builtIn;
|
|
618
|
+
const reference = parseCharacterReference(entity);
|
|
619
|
+
if (reference === null || reference.hexMarker === "X" || !Number.isInteger(reference.codePoint) || !isXmlCharacter(reference.codePoint)) return null;
|
|
620
|
+
return String.fromCodePoint(reference.codePoint);
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* A reference that is syntactically one: decoded when XML defines it, kept as
|
|
624
|
+
* written when it names an entity no declaration defines.
|
|
625
|
+
*/
|
|
626
|
+
const decodeReferenceKeepingUndeclared = (entity) => {
|
|
627
|
+
const decoded = decodeWellFormedReference(entity);
|
|
628
|
+
if (decoded !== null) return decoded;
|
|
629
|
+
if (entity.charCodeAt(0) === 35) {
|
|
630
|
+
const reference = parseCharacterReference(entity);
|
|
631
|
+
return reference === null || reference.hexMarker === "X" ? null : `&${entity};`;
|
|
632
|
+
}
|
|
633
|
+
return XML_NAME.test(entity) ? `&${entity};` : null;
|
|
634
|
+
};
|
|
635
|
+
/**
|
|
636
|
+
* Names earlier folio releases decoded in DOCX text, beyond XML's five. A part
|
|
637
|
+
* that used one opened with the character it names, and still does.
|
|
638
|
+
*/
|
|
639
|
+
const LEGACY_NAMED_REFERENCES = /* @__PURE__ */ new Map([
|
|
640
|
+
["nbsp", String.fromCodePoint(160)],
|
|
641
|
+
["copy", String.fromCodePoint(169)],
|
|
642
|
+
["reg", String.fromCodePoint(174)],
|
|
643
|
+
["trade", String.fromCodePoint(8482)],
|
|
644
|
+
["mdash", String.fromCodePoint(8212)],
|
|
645
|
+
["ndash", String.fromCodePoint(8211)],
|
|
646
|
+
["hellip", String.fromCodePoint(8230)],
|
|
647
|
+
["laquo", String.fromCodePoint(171)],
|
|
648
|
+
["raquo", String.fromCodePoint(187)],
|
|
649
|
+
["lsquo", String.fromCodePoint(8216)],
|
|
650
|
+
["rsquo", String.fromCodePoint(8217)],
|
|
651
|
+
["ldquo", String.fromCodePoint(8220)],
|
|
652
|
+
["rdquo", String.fromCodePoint(8221)],
|
|
653
|
+
["bull", String.fromCodePoint(8226)],
|
|
654
|
+
["para", String.fromCodePoint(182)],
|
|
655
|
+
["sect", String.fromCodePoint(167)],
|
|
656
|
+
["deg", String.fromCodePoint(176)],
|
|
657
|
+
["frac12", String.fromCodePoint(189)],
|
|
658
|
+
["frac14", String.fromCodePoint(188)],
|
|
659
|
+
["frac34", String.fromCodePoint(190)],
|
|
660
|
+
["cent", String.fromCodePoint(162)],
|
|
661
|
+
["pound", String.fromCodePoint(163)],
|
|
662
|
+
["curren", String.fromCodePoint(164)],
|
|
663
|
+
["yen", String.fromCodePoint(165)],
|
|
664
|
+
["euro", String.fromCodePoint(8364)],
|
|
665
|
+
["dollar", String.fromCodePoint(36)],
|
|
666
|
+
["fnof", String.fromCodePoint(402)],
|
|
667
|
+
["inr", String.fromCodePoint(8377)],
|
|
668
|
+
["af", String.fromCodePoint(1547)],
|
|
669
|
+
["birr", String.fromCodePoint(4709, 4653)],
|
|
670
|
+
["peso", String.fromCodePoint(8369)],
|
|
671
|
+
["rub", String.fromCodePoint(8381)],
|
|
672
|
+
["won", String.fromCodePoint(8361)],
|
|
673
|
+
["yuan", String.fromCodePoint(165)],
|
|
674
|
+
["cedil", String.fromCodePoint(184)]
|
|
675
|
+
]);
|
|
676
|
+
/** The longest reference body earlier releases looked for a `;` within. */
|
|
677
|
+
const LEGACY_REFERENCE_WINDOW = 32;
|
|
678
|
+
/**
|
|
679
|
+
* A reference the `ooxml` reader refuses, read the way earlier releases read
|
|
680
|
+
* it: a character reference to a control character, a surrogate or U+0000
|
|
681
|
+
* reads as nothing, one beyond U+10FFFF and an unknown name stay as written,
|
|
682
|
+
* and the digits of a character reference are read up to the first that is
|
|
683
|
+
* not one.
|
|
684
|
+
*/
|
|
685
|
+
const legacyReference = (entity) => {
|
|
686
|
+
const named = LEGACY_NAMED_REFERENCES.get(entity);
|
|
687
|
+
if (named !== void 0) return named;
|
|
688
|
+
if (entity.charCodeAt(0) !== 35) return null;
|
|
689
|
+
const marker = entity.charAt(1);
|
|
690
|
+
const hexadecimal = marker === "x" || marker === "X";
|
|
691
|
+
const codePoint = Number.parseInt(entity.slice(hexadecimal ? 2 : 1), hexadecimal ? 16 : 10);
|
|
692
|
+
if (Number.isNaN(codePoint) || codePoint < 0 || codePoint > 1114111) return null;
|
|
693
|
+
if (codePoint === 0 || codePoint >= 55296 && codePoint <= 57343 || codePoint < 32 && codePoint !== 9 && codePoint !== 10 && codePoint !== 13) return "";
|
|
694
|
+
return String.fromCodePoint(codePoint);
|
|
695
|
+
};
|
|
696
|
+
const decodeTolerantReferences = (value) => {
|
|
697
|
+
const parts = [];
|
|
698
|
+
let literalStart = 0;
|
|
699
|
+
let cursor = value.indexOf("&");
|
|
700
|
+
while (cursor !== -1) {
|
|
701
|
+
let end = cursor + 1;
|
|
702
|
+
while (end < value.length && value.charCodeAt(end) !== 59 && end - cursor <= LEGACY_REFERENCE_WINDOW) end += 1;
|
|
703
|
+
if (end >= value.length || value.charCodeAt(end) !== 59) {
|
|
704
|
+
cursor = value.indexOf("&", cursor + 1);
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
const entity = value.slice(cursor + 1, end);
|
|
708
|
+
const decoded = entity.length === 0 ? null : decodeOoxmlReference(entity) ?? legacyReference(entity);
|
|
709
|
+
if (decoded === null) {
|
|
710
|
+
cursor = value.indexOf("&", cursor + 1);
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
parts.push(value.slice(literalStart, cursor), decoded);
|
|
714
|
+
literalStart = end + 1;
|
|
715
|
+
cursor = value.indexOf("&", literalStart);
|
|
716
|
+
}
|
|
717
|
+
if (parts.length === 0) return value;
|
|
718
|
+
parts.push(value.slice(literalStart));
|
|
719
|
+
return parts.join("");
|
|
720
|
+
};
|
|
721
|
+
const hasOnlyDigits = (value, hexadecimal) => {
|
|
722
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
723
|
+
const code = value.charCodeAt(index);
|
|
724
|
+
if (!(code >= 48 && code <= 57) && !(hexadecimal && code >= 97 && code <= 102) && !(hexadecimal && code >= 65 && code <= 70)) return false;
|
|
725
|
+
}
|
|
726
|
+
return true;
|
|
727
|
+
};
|
|
728
|
+
const isUnsafePropertyName = (name) => {
|
|
729
|
+
switch (name) {
|
|
730
|
+
case "__defineGetter__":
|
|
731
|
+
case "__defineSetter__":
|
|
732
|
+
case "__lookupGetter__":
|
|
733
|
+
case "__lookupSetter__":
|
|
734
|
+
case "__proto__":
|
|
735
|
+
case "constructor":
|
|
736
|
+
case "hasOwnProperty":
|
|
737
|
+
case "prototype":
|
|
738
|
+
case "toString":
|
|
739
|
+
case "valueOf": return true;
|
|
740
|
+
default: return false;
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
export { parseStreamingXmlWithSourceRanges as a, scanStreamingXmlElements as c, ID_VALUE_ELEMENTS as d, NUMBERING_ATTRIBUTES as f, parseStreamingXmlWithIdentityVisitor as i, scanStreamingXmlNumericIdAttributes as l, localName as m, getXmlSourceRange as n, readXml as o, isOoxmlNumericIdAttributeName as p, parseStreamingXml as r, rewriteStreamingXmlDecimalAttributes as s, XmlReadError as t, wellFormedXmlIssue as u };
|