uss-xsd-engine 0.1.0-beta.5 → 0.1.0-rc.1

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/README.md CHANGED
@@ -102,11 +102,11 @@ console.log(result.issues);
102
102
  ### CDN/Browser
103
103
 
104
104
  ```HTML
105
- <script src="https://unpkg.com/uss-xsd-engine@0.1.0-beta.5/dist/uss-xsd-engine.standalone.js"></script>
105
+ <script src="https://unpkg.com/uss-xsd-engine@latest/dist/uss-xsd-engine.standalone.js"></script>
106
106
 
107
107
  or
108
108
 
109
- <script src="https://cdn.jsdelivr.net/npm/uss-xsd-engine@0.1.0-beta.5/dist/uss-xsd-engine.esm.min.js"></script>
109
+ <script src="https://cdn.jsdelivr.net/npm/uss-xsd-engine@latest/dist/uss-xsd-engine.esm.min.js"></script>
110
110
 
111
111
  <script>
112
112
  const result = UssXsdEngine.getSchemaDiagnostics({ xsdText });
@@ -299,38 +299,64 @@ Use **uss-xsd-engine** if you need:
299
299
  ---
300
300
 
301
301
  ## ⚠️ Supported vs Not Fully Supported
302
- ### ✅ Supported (v0.1.x)
303
- - Most common XSD structures
304
- - Namespace-aware resolution
302
+ ### ✅ Supported (v0.1.x / RC)
303
+ - XSD parsing into an internal schema model
304
+ - Namespace-aware resolution (elements, types, attributes, groups)
305
305
  - Extensions (`xs:extension`)
306
- - Restrictions (subset + occurrence checks)
307
- - Facet validation (including pattern)
308
- - Default / fixed semantics
309
- - Include/import (manual provision with recursive resolution)
310
- - Sample XML generation (namespace-aware, multi-schema support)
311
- - XML validation (structure, facets, and source-mapped diagnostics)
306
+ - Restrictions (subset enforcement, occurrence narrowing, attribute constraints)
307
+ - Facet validation:
308
+ - length, numeric, pattern, enumeration, digits
309
+ - Default / fixed semantics (schema + XML validation)
310
+ - Include/import:
311
+ - manual provision via `externalDocuments`
312
+ - recursive resolution
313
+ - strict namespace enforcement
314
+ - Chameleon includes (namespace adoption for no-targetNamespace schemas)
315
+ - Namespace-aware sample XML generation:
316
+ - minimal + representative modes
317
+ - pattern-aware generation (e.g., UETR, BIC)
318
+ - XML validation:
319
+ - structural validation (sequence, choice, all, groups)
320
+ - simpleContent + complexContent enforcement
321
+ - mixed content handling
322
+ - restriction validation (pass 2)
323
+ - Root and nested `simpleContent` validation alignment
312
324
  - XML parse diagnostics with line/column support
313
- - Semantic validation diagnostics with line/column support
314
- - Attribute and value-level source mapping
325
+ - Semantic XML diagnostics with line/column support
326
+ - Attribute, value, and text source mapping
315
327
  - Namespace-aware schema tree extraction
328
+ - Imported schema isolation with namespace-safe lookup
329
+ - QName resolution:
330
+ - prefixed + default namespace handling
331
+ - no cross-namespace leakage
316
332
 
317
333
  ---
318
334
 
319
335
  ## ⚠️ Partially Supported / In Progress
320
- - Deep sample XML expansion (choice branching, recursion depth)
321
- - Full restriction theorem validation (advanced edge cases)
322
- - Advanced Namespace handling (prefix customizatioon, default namespace strategies)
323
- - Advanced wildcard (`xs:any`, `xs:anyAttribute`)
324
- - Attribute namespace qualification
336
+ - Deep sample XML expansion:
337
+ - complex choice branching
338
+ - recursion depth control
339
+ - Full restriction theorem validation:
340
+ - advanced edge cases (beyond practical subset checks)
341
+ - Advanced wildcard handling:
342
+ - `xs:any`
343
+ - `xs:anyAttribute`
344
+ - Attribute namespace qualification edge cases
325
345
 
326
346
  ---
327
347
 
328
348
  ## ❌ Not Supported Yet
329
- - Identity constraints (`xs:key`, `xs:keyref`, `xs:unique`)
349
+ - Identity constraints:
350
+ - `xs:key`
351
+ - `xs:keyref`
352
+ - `xs:unique`
353
+ - `xs:redefine`
330
354
  - Automatic network fetching of schemas
331
- - Full W3C spec conformance (edge-case completeness)
332
- - Streaming validation for very large XML
333
- - Chameleon includes (namespace adaptation)
355
+ - (engine is intentionally browser-first and caller-driven)
356
+ - Full W3C spec completeness
357
+ - (focus is practical + real-world coverage)
358
+ - Streaming / incremental validation for very large XML
359
+
334
360
 
335
361
  ---
336
362
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * uss-xsd-engine v0.1.0-beta.5
2
+ * uss-xsd-engine v0.1.0-rc.1
3
3
  * (c) 2026 Bernard Mumble
4
4
  * MIT License
5
5
  */
@@ -60,6 +60,7 @@ var ISSUE_CODES = {
60
60
  XML_INVALID_TEXT_FOR_COMPLEX_TYPE: "XML_INVALID_TEXT_FOR_COMPLEX_TYPE",
61
61
  XML_VALUE_INVALID: "XML_VALUE_INVALID",
62
62
  XML_ENUMERATION_MISMATCH: "XML_ENUMERATION_MISMATCH",
63
+ XML_VALUE_REQUIRED: "XML_VALUE_REQUIRED",
63
64
  XML_PATTERN_MISMATCH: "XML_PATTERN_MISMATCH",
64
65
  XML_LENGTH_MISMATCH: "XML_LENGTH_MISMATCH",
65
66
  XML_MIN_LENGTH_VIOLATION: "XML_MIN_LENGTH_VIOLATION",
@@ -1775,7 +1776,7 @@ function buildSchemaModel(doc, options = {}) {
1775
1776
  }
1776
1777
  const externalRoot = getSchemaRoot(externalDoc);
1777
1778
  const externalDeclaredTargetNamespace = externalRoot?.getAttribute("targetNamespace") || null;
1778
- const shouldApplyChameleonInclude = ref.kind === "include" && (schema.targetNamespace || null) !== null && externalDeclaredTargetNamespace === null;
1779
+ const shouldApplyChameleonInclude = ref.kind === "include" && externalDeclaredTargetNamespace === null;
1779
1780
  const externalBuild = buildSchemaModel(externalDoc, {
1780
1781
  ...options,
1781
1782
  xsdText: externalXsdText,
@@ -2400,6 +2401,9 @@ function runSchemaDiagnostics(schema, options = {}) {
2400
2401
  };
2401
2402
  }
2402
2403
 
2404
+ // src/version.js
2405
+ var ENGINE_VERSION = "v0.1.0-rc.1";
2406
+
2403
2407
  // src/utils/result.js
2404
2408
  function summarizeIssues(issues = []) {
2405
2409
  return issues.reduce(
@@ -2420,7 +2424,8 @@ function makeResult({ data = null, issues = [] } = {}) {
2420
2424
  ok: !hasErrors(issues),
2421
2425
  data,
2422
2426
  issues,
2423
- summary: summarizeIssues(issues)
2427
+ summary: summarizeIssues(issues),
2428
+ version: ENGINE_VERSION
2424
2429
  };
2425
2430
  }
2426
2431
 
@@ -4805,6 +4810,27 @@ function validateXmlAgainstSchema(schema, xmlText, options = {}, helpers = {}) {
4805
4810
  const isSimpleContent = resolvedRootType?.contentModel === "simple" && resolvedRootType?.derivation?.baseTypeName;
4806
4811
  if (isSimpleContent) {
4807
4812
  const textValue = (xmlRoot.textContent || "").trim();
4813
+ const children2 = elementChildren3(xmlRoot);
4814
+ if (children2.length > 0) {
4815
+ for (const childNode of children2) {
4816
+ const childName = localName2(childNode);
4817
+ issues.push(
4818
+ createIssue({
4819
+ code: ISSUE_CODES.XML_UNEXPECTED_ELEMENT,
4820
+ severity: "error",
4821
+ message: `Unexpected element '${childName}'.`,
4822
+ ...toLocationFields(locator.getNodeLocation(childNode)),
4823
+ path: `/${xmlRootName}/${childName}`,
4824
+ source: "xml",
4825
+ nodeKind: "element",
4826
+ name: childName,
4827
+ details: {
4828
+ namespaceUri: namespaceUri2(childNode)
4829
+ }
4830
+ })
4831
+ );
4832
+ }
4833
+ }
4808
4834
  if (!textValue) {
4809
4835
  issues.push(
4810
4836
  createIssue({
@@ -4822,10 +4848,6 @@ function validateXmlAgainstSchema(schema, xmlText, options = {}, helpers = {}) {
4822
4848
  })
4823
4849
  );
4824
4850
  } else {
4825
- const baseType = resolveType(
4826
- schema,
4827
- resolvedRootType.derivation.baseTypeName
4828
- );
4829
4851
  const valueResult = validateElementValue(
4830
4852
  schema,
4831
4853
  { ...schemaRoot, typeName: resolvedRootType.derivation.baseTypeName },
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * uss-xsd-engine v0.1.0-beta.5
2
+ * uss-xsd-engine v0.1.0-rc.1
3
3
  * (c) 2026 Bernard Mumble
4
4
  * MIT License
5
5
  */
@@ -87,6 +87,7 @@ var UssXsdEngine = (() => {
87
87
  XML_INVALID_TEXT_FOR_COMPLEX_TYPE: "XML_INVALID_TEXT_FOR_COMPLEX_TYPE",
88
88
  XML_VALUE_INVALID: "XML_VALUE_INVALID",
89
89
  XML_ENUMERATION_MISMATCH: "XML_ENUMERATION_MISMATCH",
90
+ XML_VALUE_REQUIRED: "XML_VALUE_REQUIRED",
90
91
  XML_PATTERN_MISMATCH: "XML_PATTERN_MISMATCH",
91
92
  XML_LENGTH_MISMATCH: "XML_LENGTH_MISMATCH",
92
93
  XML_MIN_LENGTH_VIOLATION: "XML_MIN_LENGTH_VIOLATION",
@@ -1802,7 +1803,7 @@ var UssXsdEngine = (() => {
1802
1803
  }
1803
1804
  const externalRoot = getSchemaRoot(externalDoc);
1804
1805
  const externalDeclaredTargetNamespace = externalRoot?.getAttribute("targetNamespace") || null;
1805
- const shouldApplyChameleonInclude = ref.kind === "include" && (schema.targetNamespace || null) !== null && externalDeclaredTargetNamespace === null;
1806
+ const shouldApplyChameleonInclude = ref.kind === "include" && externalDeclaredTargetNamespace === null;
1806
1807
  const externalBuild = buildSchemaModel(externalDoc, {
1807
1808
  ...options,
1808
1809
  xsdText: externalXsdText,
@@ -2427,6 +2428,9 @@ var UssXsdEngine = (() => {
2427
2428
  };
2428
2429
  }
2429
2430
 
2431
+ // src/version.js
2432
+ var ENGINE_VERSION = "v0.1.0-rc.1";
2433
+
2430
2434
  // src/utils/result.js
2431
2435
  function summarizeIssues(issues = []) {
2432
2436
  return issues.reduce(
@@ -2447,7 +2451,8 @@ var UssXsdEngine = (() => {
2447
2451
  ok: !hasErrors(issues),
2448
2452
  data,
2449
2453
  issues,
2450
- summary: summarizeIssues(issues)
2454
+ summary: summarizeIssues(issues),
2455
+ version: ENGINE_VERSION
2451
2456
  };
2452
2457
  }
2453
2458
 
@@ -4832,6 +4837,27 @@ ${writeNode(rootNode, 0)}`;
4832
4837
  const isSimpleContent = resolvedRootType?.contentModel === "simple" && resolvedRootType?.derivation?.baseTypeName;
4833
4838
  if (isSimpleContent) {
4834
4839
  const textValue = (xmlRoot.textContent || "").trim();
4840
+ const children2 = elementChildren3(xmlRoot);
4841
+ if (children2.length > 0) {
4842
+ for (const childNode of children2) {
4843
+ const childName = localName2(childNode);
4844
+ issues.push(
4845
+ createIssue({
4846
+ code: ISSUE_CODES.XML_UNEXPECTED_ELEMENT,
4847
+ severity: "error",
4848
+ message: `Unexpected element '${childName}'.`,
4849
+ ...toLocationFields(locator.getNodeLocation(childNode)),
4850
+ path: `/${xmlRootName}/${childName}`,
4851
+ source: "xml",
4852
+ nodeKind: "element",
4853
+ name: childName,
4854
+ details: {
4855
+ namespaceUri: namespaceUri2(childNode)
4856
+ }
4857
+ })
4858
+ );
4859
+ }
4860
+ }
4835
4861
  if (!textValue) {
4836
4862
  issues.push(
4837
4863
  createIssue({
@@ -4849,10 +4875,6 @@ ${writeNode(rootNode, 0)}`;
4849
4875
  })
4850
4876
  );
4851
4877
  } else {
4852
- const baseType = resolveType(
4853
- schema,
4854
- resolvedRootType.derivation.baseTypeName
4855
- );
4856
4878
  const valueResult = validateElementValue(
4857
4879
  schema,
4858
4880
  { ...schemaRoot, typeName: resolvedRootType.derivation.baseTypeName },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uss-xsd-engine",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-rc.1",
4
4
  "description": "Browser-first XSD engine for schema diagnostics, tree extraction, sample XML generation, and XML validation.",
5
5
  "type": "module",
6
6
  "main": "dist/uss-xsd-engine.esm.js",
@@ -30,6 +30,7 @@
30
30
  "url": "https://github.com/mumblebaj/uss-xsd-engine/issues"
31
31
  },
32
32
  "scripts": {
33
+ "write": "node scripts/write-version.js",
33
34
  "build": "node scripts/build.mjs",
34
35
  "clean": "rm -rf dist",
35
36
  "check:git": "git diff --quiet && git diff --cached --quiet",