pro-editor-schema 0.1.13 → 0.1.14

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/index.d.mts CHANGED
@@ -458,7 +458,7 @@ type ValidationError = {
458
458
  };
459
459
 
460
460
  declare const validateElement: (element: Element, root: Element, referenceChapterLinkends?: readonly string[]) => ValidationError[];
461
- declare const validateXml: (xml: string, referenceChapterLinkends?: readonly string[]) => ValidationError[];
461
+ declare const validateXml: (xml: Element | HTMLElement, referenceChapterLinkends?: readonly string[]) => ValidationError[];
462
462
 
463
463
  declare const validateFootnoteCue: (footnoteElement: Element, root: Element) => ValidationError[];
464
464
  declare const validateConsecutiveFootnotes: (root: Element) => ValidationError[];
package/dist/index.d.ts CHANGED
@@ -458,7 +458,7 @@ type ValidationError = {
458
458
  };
459
459
 
460
460
  declare const validateElement: (element: Element, root: Element, referenceChapterLinkends?: readonly string[]) => ValidationError[];
461
- declare const validateXml: (xml: string, referenceChapterLinkends?: readonly string[]) => ValidationError[];
461
+ declare const validateXml: (xml: Element | HTMLElement, referenceChapterLinkends?: readonly string[]) => ValidationError[];
462
462
 
463
463
  declare const validateFootnoteCue: (footnoteElement: Element, root: Element) => ValidationError[];
464
464
  declare const validateConsecutiveFootnotes: (root: Element) => ValidationError[];
package/dist/index.js CHANGED
@@ -2281,22 +2281,6 @@ var validateChildren = (element, schema) => {
2281
2281
  return errors;
2282
2282
  };
2283
2283
 
2284
- // src/validation/utils/parseXML.ts
2285
- var parseXml = (xml) => {
2286
- const doc = new DOMParser().parseFromString(xml.trim(), "application/xml");
2287
- const parserError = doc.querySelector("parsererror");
2288
- if (parserError) {
2289
- throw new Error(
2290
- `Unable to parse XML: ${parserError.textContent ?? "unknown error"}`
2291
- );
2292
- }
2293
- const element = doc.documentElement;
2294
- if (!element) {
2295
- throw new Error("XML string did not produce an element");
2296
- }
2297
- return element;
2298
- };
2299
-
2300
2284
  // src/validation/validateXml.ts
2301
2285
  var getLinkableRoles = () => {
2302
2286
  const linkRoleDefinition = findAttributeDefinitionByName(
@@ -2334,12 +2318,11 @@ var validateElement = (element, root, referenceChapterLinkends) => {
2334
2318
  return errors;
2335
2319
  };
2336
2320
  var validateXml = (xml, referenceChapterLinkends) => {
2337
- const root = parseXml(xml);
2338
2321
  const errors = [];
2339
- errors.push(...validateConsecutiveFootnotes(root));
2340
- errors.push(...validateConsecutiveFootnoteCues(root));
2341
- for (const child of Array.from(root.children)) {
2342
- errors.push(...validateElement(child, root, referenceChapterLinkends));
2322
+ errors.push(...validateConsecutiveFootnotes(xml));
2323
+ errors.push(...validateConsecutiveFootnoteCues(xml));
2324
+ for (const child of Array.from(xml.children)) {
2325
+ errors.push(...validateElement(child, xml, referenceChapterLinkends));
2343
2326
  }
2344
2327
  return errors;
2345
2328
  };
package/dist/index.mjs CHANGED
@@ -2056,22 +2056,6 @@ var validateChildren = (element, schema) => {
2056
2056
  return errors;
2057
2057
  };
2058
2058
 
2059
- // src/validation/utils/parseXML.ts
2060
- var parseXml = (xml) => {
2061
- const doc = new DOMParser().parseFromString(xml.trim(), "application/xml");
2062
- const parserError = doc.querySelector("parsererror");
2063
- if (parserError) {
2064
- throw new Error(
2065
- `Unable to parse XML: ${parserError.textContent ?? "unknown error"}`
2066
- );
2067
- }
2068
- const element = doc.documentElement;
2069
- if (!element) {
2070
- throw new Error("XML string did not produce an element");
2071
- }
2072
- return element;
2073
- };
2074
-
2075
2059
  // src/validation/validateXml.ts
2076
2060
  var getLinkableRoles = () => {
2077
2061
  const linkRoleDefinition = findAttributeDefinitionByName(
@@ -2109,12 +2093,11 @@ var validateElement = (element, root, referenceChapterLinkends) => {
2109
2093
  return errors;
2110
2094
  };
2111
2095
  var validateXml = (xml, referenceChapterLinkends) => {
2112
- const root = parseXml(xml);
2113
2096
  const errors = [];
2114
- errors.push(...validateConsecutiveFootnotes(root));
2115
- errors.push(...validateConsecutiveFootnoteCues(root));
2116
- for (const child of Array.from(root.children)) {
2117
- errors.push(...validateElement(child, root, referenceChapterLinkends));
2097
+ errors.push(...validateConsecutiveFootnotes(xml));
2098
+ errors.push(...validateConsecutiveFootnoteCues(xml));
2099
+ for (const child of Array.from(xml.children)) {
2100
+ errors.push(...validateElement(child, xml, referenceChapterLinkends));
2118
2101
  }
2119
2102
  return errors;
2120
2103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pro-editor-schema",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Pro Editor XML schemas",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",