@abapify/ts-xsd 0.4.1 → 0.4.4
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 +143 -211
- package/dist/codegen/cli.d.mts +1 -1
- package/dist/codegen/cli.mjs +2 -2
- package/dist/codegen/cli.mjs.map +1 -1
- package/dist/{generate-DnX2dJZe.mjs → generate-BsE7j6DV.mjs} +5 -5
- package/dist/generate-BsE7j6DV.mjs.map +1 -0
- package/dist/generators/index.d.mts +1 -2
- package/dist/generators/index.d.mts.map +1 -1
- package/dist/generators/index.mjs +7 -7
- package/dist/generators/index.mjs.map +1 -1
- package/dist/index.d.mts +60 -40
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +998 -51
- package/dist/index.mjs.map +1 -1
- package/dist/{runner-C4_p2y5e.d.mts → runner-D1RCU_go.d.mts} +6 -3
- package/dist/runner-D1RCU_go.d.mts.map +1 -0
- package/dist/{runner-CRhT3smd.mjs → runner-DX40fZp_.mjs} +49 -852
- package/dist/runner-DX40fZp_.mjs.map +1 -0
- package/dist/{types-CtrpGRyM.mjs → types-DqeG5gw1.mjs} +42 -16
- package/dist/types-DqeG5gw1.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/generate-DnX2dJZe.mjs.map +0 -1
- package/dist/runner-C4_p2y5e.d.mts.map +0 -1
- package/dist/runner-CRhT3smd.mjs.map +0 -1
- package/dist/types-CtrpGRyM.mjs.map +0 -1
|
@@ -131,9 +131,7 @@ function parseSchema(el) {
|
|
|
131
131
|
case "notation":
|
|
132
132
|
pushTo(schema, "notation", parseNotation(child));
|
|
133
133
|
break;
|
|
134
|
-
case "defaultOpenContent":
|
|
135
|
-
schema.defaultOpenContent = parseDefaultOpenContent(child);
|
|
136
|
-
break;
|
|
134
|
+
case "defaultOpenContent": schema.defaultOpenContent = parseDefaultOpenContent(child);
|
|
137
135
|
}
|
|
138
136
|
return schema;
|
|
139
137
|
}
|
|
@@ -194,9 +192,7 @@ function parseRedefine(el) {
|
|
|
194
192
|
case "group":
|
|
195
193
|
pushTo(result, "group", parseNamedGroup(child));
|
|
196
194
|
break;
|
|
197
|
-
case "attributeGroup":
|
|
198
|
-
pushTo(result, "attributeGroup", parseNamedAttributeGroup(child));
|
|
199
|
-
break;
|
|
195
|
+
case "attributeGroup": pushTo(result, "attributeGroup", parseNamedAttributeGroup(child));
|
|
200
196
|
}
|
|
201
197
|
return result;
|
|
202
198
|
}
|
|
@@ -226,9 +222,7 @@ function parseOverride(el) {
|
|
|
226
222
|
case "attribute":
|
|
227
223
|
pushTo(result, "attribute", parseTopLevelAttribute(child));
|
|
228
224
|
break;
|
|
229
|
-
case "notation":
|
|
230
|
-
pushTo(result, "notation", parseNotation(child));
|
|
231
|
-
break;
|
|
225
|
+
case "notation": pushTo(result, "notation", parseNotation(child));
|
|
232
226
|
}
|
|
233
227
|
return result;
|
|
234
228
|
}
|
|
@@ -261,9 +255,7 @@ function parseTopLevelElement(el) {
|
|
|
261
255
|
case "keyref":
|
|
262
256
|
pushTo(result, "keyref", parseKeyref(child));
|
|
263
257
|
break;
|
|
264
|
-
case "alternative":
|
|
265
|
-
pushTo(result, "alternative", parseAlternative(child));
|
|
266
|
-
break;
|
|
258
|
+
case "alternative": pushTo(result, "alternative", parseAlternative(child));
|
|
267
259
|
}
|
|
268
260
|
return result;
|
|
269
261
|
}
|
|
@@ -298,9 +290,7 @@ function parseLocalElement(el) {
|
|
|
298
290
|
case "keyref":
|
|
299
291
|
pushTo(result, "keyref", parseKeyref(child));
|
|
300
292
|
break;
|
|
301
|
-
case "alternative":
|
|
302
|
-
pushTo(result, "alternative", parseAlternative(child));
|
|
303
|
-
break;
|
|
293
|
+
case "alternative": pushTo(result, "alternative", parseAlternative(child));
|
|
304
294
|
}
|
|
305
295
|
return result;
|
|
306
296
|
}
|
|
@@ -385,9 +375,7 @@ function parseComplexTypeContent(el, result) {
|
|
|
385
375
|
case "anyAttribute":
|
|
386
376
|
result.anyAttribute = parseAnyAttribute(child);
|
|
387
377
|
break;
|
|
388
|
-
case "assert":
|
|
389
|
-
pushTo(result, "assert", parseAssertion(child));
|
|
390
|
-
break;
|
|
378
|
+
case "assert": pushTo(result, "assert", parseAssertion(child));
|
|
391
379
|
}
|
|
392
380
|
}
|
|
393
381
|
function parseTopLevelSimpleType(el) {
|
|
@@ -414,9 +402,7 @@ function parseSimpleTypeContent(el, result) {
|
|
|
414
402
|
case "list":
|
|
415
403
|
result.list = parseList(child);
|
|
416
404
|
break;
|
|
417
|
-
case "union":
|
|
418
|
-
result.union = parseUnion(child);
|
|
419
|
-
break;
|
|
405
|
+
case "union": result.union = parseUnion(child);
|
|
420
406
|
}
|
|
421
407
|
}
|
|
422
408
|
function parseSimpleTypeRestriction(el) {
|
|
@@ -447,9 +433,7 @@ function parseSimpleTypeRestriction(el) {
|
|
|
447
433
|
case "pattern":
|
|
448
434
|
pushTo(result, "pattern", parsePattern(child));
|
|
449
435
|
break;
|
|
450
|
-
case "assertion":
|
|
451
|
-
pushTo(result, "assertion", parseAssertion(child));
|
|
452
|
-
break;
|
|
436
|
+
case "assertion": pushTo(result, "assertion", parseAssertion(child));
|
|
453
437
|
}
|
|
454
438
|
}
|
|
455
439
|
return result;
|
|
@@ -564,9 +548,7 @@ function parseSimpleContentRestriction(el) {
|
|
|
564
548
|
case "anyAttribute":
|
|
565
549
|
result.anyAttribute = parseAnyAttribute(child);
|
|
566
550
|
break;
|
|
567
|
-
case "assert":
|
|
568
|
-
pushTo(result, "assert", parseAssertion(child));
|
|
569
|
-
break;
|
|
551
|
+
case "assert": pushTo(result, "assert", parseAssertion(child));
|
|
570
552
|
}
|
|
571
553
|
}
|
|
572
554
|
return result;
|
|
@@ -586,9 +568,7 @@ function parseSimpleContentExtension(el) {
|
|
|
586
568
|
case "anyAttribute":
|
|
587
569
|
result.anyAttribute = parseAnyAttribute(child);
|
|
588
570
|
break;
|
|
589
|
-
case "assert":
|
|
590
|
-
pushTo(result, "assert", parseAssertion(child));
|
|
591
|
-
break;
|
|
571
|
+
case "assert": pushTo(result, "assert", parseAssertion(child));
|
|
592
572
|
}
|
|
593
573
|
return result;
|
|
594
574
|
}
|
|
@@ -611,9 +591,7 @@ function parseExplicitGroup(el) {
|
|
|
611
591
|
case "sequence":
|
|
612
592
|
pushTo(result, "sequence", parseExplicitGroup(child));
|
|
613
593
|
break;
|
|
614
|
-
case "any":
|
|
615
|
-
pushTo(result, "any", parseAny(child));
|
|
616
|
-
break;
|
|
594
|
+
case "any": pushTo(result, "any", parseAny(child));
|
|
617
595
|
}
|
|
618
596
|
return result;
|
|
619
597
|
}
|
|
@@ -630,9 +608,7 @@ function parseAll(el) {
|
|
|
630
608
|
case "any":
|
|
631
609
|
pushTo(result, "any", parseAny(child));
|
|
632
610
|
break;
|
|
633
|
-
case "group":
|
|
634
|
-
pushTo(result, "group", parseGroupRef(child));
|
|
635
|
-
break;
|
|
611
|
+
case "group": pushTo(result, "group", parseGroupRef(child));
|
|
636
612
|
}
|
|
637
613
|
return result;
|
|
638
614
|
}
|
|
@@ -648,9 +624,7 @@ function parseNamedGroup(el) {
|
|
|
648
624
|
case "choice":
|
|
649
625
|
result.choice = parseExplicitGroup(child);
|
|
650
626
|
break;
|
|
651
|
-
case "sequence":
|
|
652
|
-
result.sequence = parseExplicitGroup(child);
|
|
653
|
-
break;
|
|
627
|
+
case "sequence": result.sequence = parseExplicitGroup(child);
|
|
654
628
|
}
|
|
655
629
|
return result;
|
|
656
630
|
}
|
|
@@ -675,9 +649,7 @@ function parseNamedAttributeGroup(el) {
|
|
|
675
649
|
case "attributeGroup":
|
|
676
650
|
pushTo(result, "attributeGroup", parseAttributeGroupRef(child));
|
|
677
651
|
break;
|
|
678
|
-
case "anyAttribute":
|
|
679
|
-
result.anyAttribute = parseAnyAttribute(child);
|
|
680
|
-
break;
|
|
652
|
+
case "anyAttribute": result.anyAttribute = parseAnyAttribute(child);
|
|
681
653
|
}
|
|
682
654
|
return result;
|
|
683
655
|
}
|
|
@@ -879,810 +851,6 @@ function copyXmlns(el, target) {
|
|
|
879
851
|
if (xmlns) target.$xmlns = xmlns;
|
|
880
852
|
}
|
|
881
853
|
|
|
882
|
-
//#endregion
|
|
883
|
-
//#region src/xsd/build.ts
|
|
884
|
-
/**
|
|
885
|
-
* Build an XSD string from a typed Schema object
|
|
886
|
-
*/
|
|
887
|
-
function buildXsd(schema, options = {}) {
|
|
888
|
-
const prefix = options.prefix ?? "xs";
|
|
889
|
-
const pretty = options.pretty ?? true;
|
|
890
|
-
const ctx = {
|
|
891
|
-
prefix,
|
|
892
|
-
pretty,
|
|
893
|
-
indent: options.indent ?? " ",
|
|
894
|
-
level: 0
|
|
895
|
-
};
|
|
896
|
-
const lines = [];
|
|
897
|
-
lines.push("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
898
|
-
lines.push(buildSchema(schema, ctx));
|
|
899
|
-
return lines.join(pretty ? "\n" : "");
|
|
900
|
-
}
|
|
901
|
-
function buildSchema(schema, ctx) {
|
|
902
|
-
const attrs = [];
|
|
903
|
-
if (schema.$xmlns) for (const [prefix, uri] of Object.entries(schema.$xmlns)) if (prefix === "") attrs.push(`xmlns="${uri}"`);
|
|
904
|
-
else attrs.push(`xmlns:${prefix}="${uri}"`);
|
|
905
|
-
addAttr(attrs, "id", schema.id);
|
|
906
|
-
addAttr(attrs, "targetNamespace", schema.targetNamespace);
|
|
907
|
-
addAttr(attrs, "version", schema.version);
|
|
908
|
-
addAttr(attrs, "finalDefault", schema.finalDefault);
|
|
909
|
-
addAttr(attrs, "blockDefault", schema.blockDefault);
|
|
910
|
-
addAttr(attrs, "attributeFormDefault", schema.attributeFormDefault);
|
|
911
|
-
addAttr(attrs, "elementFormDefault", schema.elementFormDefault);
|
|
912
|
-
addAttr(attrs, "defaultAttributes", schema.defaultAttributes);
|
|
913
|
-
addAttr(attrs, "xpathDefaultNamespace", schema.xpathDefaultNamespace);
|
|
914
|
-
addAttr(attrs, "xml:lang", schema["xml:lang"]);
|
|
915
|
-
const children = [];
|
|
916
|
-
const childCtx = {
|
|
917
|
-
...ctx,
|
|
918
|
-
level: ctx.level + 1
|
|
919
|
-
};
|
|
920
|
-
if (schema.annotation) for (const ann of schema.annotation) children.push(buildAnnotation(ann, childCtx));
|
|
921
|
-
if (schema.include) for (const inc of schema.include) children.push(buildInclude(inc, childCtx));
|
|
922
|
-
if (schema.import) for (const imp of schema.import) children.push(buildImport(imp, childCtx));
|
|
923
|
-
if (schema.redefine) for (const red of schema.redefine) children.push(buildRedefine(red, childCtx));
|
|
924
|
-
if (schema.override) for (const ovr of schema.override) children.push(buildOverride(ovr, childCtx));
|
|
925
|
-
if (schema.defaultOpenContent) children.push(buildDefaultOpenContent(schema.defaultOpenContent, childCtx));
|
|
926
|
-
if (schema.simpleType && Array.isArray(schema.simpleType)) for (const st of schema.simpleType) children.push(buildTopLevelSimpleType(st, childCtx));
|
|
927
|
-
if (schema.complexType && Array.isArray(schema.complexType)) for (const ct of schema.complexType) children.push(buildTopLevelComplexType(ct, childCtx));
|
|
928
|
-
if (schema.group) for (const grp of schema.group) children.push(buildNamedGroup(grp, childCtx));
|
|
929
|
-
if (schema.attributeGroup) for (const ag of schema.attributeGroup) children.push(buildNamedAttributeGroup(ag, childCtx));
|
|
930
|
-
if (schema.element) for (const el of schema.element) children.push(buildTopLevelElement(el, childCtx));
|
|
931
|
-
if (schema.attribute) for (const attr of schema.attribute) children.push(buildTopLevelAttribute(attr, childCtx));
|
|
932
|
-
if (schema.notation) for (const not of schema.notation) children.push(buildNotation(not, childCtx));
|
|
933
|
-
return buildElement(`${ctx.prefix}:schema`, attrs, children, ctx);
|
|
934
|
-
}
|
|
935
|
-
function buildAnnotation(ann, ctx) {
|
|
936
|
-
const attrs = [];
|
|
937
|
-
addAttr(attrs, "id", ann.id);
|
|
938
|
-
const children = [];
|
|
939
|
-
const childCtx = {
|
|
940
|
-
...ctx,
|
|
941
|
-
level: ctx.level + 1
|
|
942
|
-
};
|
|
943
|
-
if (ann.appinfo) for (const ai of ann.appinfo) children.push(buildAppinfo(ai, childCtx));
|
|
944
|
-
if (ann.documentation) for (const doc of ann.documentation) children.push(buildDocumentation(doc, childCtx));
|
|
945
|
-
return buildElement(`${ctx.prefix}:annotation`, attrs, children, ctx);
|
|
946
|
-
}
|
|
947
|
-
function buildDocumentation(doc, ctx) {
|
|
948
|
-
const attrs = [];
|
|
949
|
-
addAttr(attrs, "source", doc.source);
|
|
950
|
-
addAttr(attrs, "xml:lang", doc["xml:lang"]);
|
|
951
|
-
if (doc._text) return buildElementWithText(`${ctx.prefix}:documentation`, attrs, doc._text, ctx);
|
|
952
|
-
return buildElement(`${ctx.prefix}:documentation`, attrs, [], ctx);
|
|
953
|
-
}
|
|
954
|
-
function buildAppinfo(ai, ctx) {
|
|
955
|
-
const attrs = [];
|
|
956
|
-
addAttr(attrs, "source", ai.source);
|
|
957
|
-
if (ai._text) return buildElementWithText(`${ctx.prefix}:appinfo`, attrs, ai._text, ctx);
|
|
958
|
-
return buildElement(`${ctx.prefix}:appinfo`, attrs, [], ctx);
|
|
959
|
-
}
|
|
960
|
-
function buildInclude(inc, ctx) {
|
|
961
|
-
const attrs = [];
|
|
962
|
-
addAttr(attrs, "id", inc.id);
|
|
963
|
-
addAttr(attrs, "schemaLocation", inc.schemaLocation);
|
|
964
|
-
const children = [];
|
|
965
|
-
if (inc.annotation) children.push(buildAnnotation(inc.annotation, {
|
|
966
|
-
...ctx,
|
|
967
|
-
level: ctx.level + 1
|
|
968
|
-
}));
|
|
969
|
-
return buildElement(`${ctx.prefix}:include`, attrs, children, ctx);
|
|
970
|
-
}
|
|
971
|
-
function buildImport(imp, ctx) {
|
|
972
|
-
const attrs = [];
|
|
973
|
-
addAttr(attrs, "id", imp.id);
|
|
974
|
-
addAttr(attrs, "namespace", imp.namespace);
|
|
975
|
-
addAttr(attrs, "schemaLocation", imp.schemaLocation);
|
|
976
|
-
const children = [];
|
|
977
|
-
if (imp.annotation) children.push(buildAnnotation(imp.annotation, {
|
|
978
|
-
...ctx,
|
|
979
|
-
level: ctx.level + 1
|
|
980
|
-
}));
|
|
981
|
-
return buildElement(`${ctx.prefix}:import`, attrs, children, ctx);
|
|
982
|
-
}
|
|
983
|
-
function buildRedefine(red, ctx) {
|
|
984
|
-
const attrs = [];
|
|
985
|
-
addAttr(attrs, "id", red.id);
|
|
986
|
-
addAttr(attrs, "schemaLocation", red.schemaLocation);
|
|
987
|
-
const children = [];
|
|
988
|
-
const childCtx = {
|
|
989
|
-
...ctx,
|
|
990
|
-
level: ctx.level + 1
|
|
991
|
-
};
|
|
992
|
-
if (red.annotation) for (const ann of red.annotation) children.push(buildAnnotation(ann, childCtx));
|
|
993
|
-
if (red.simpleType) for (const st of red.simpleType) children.push(buildTopLevelSimpleType(st, childCtx));
|
|
994
|
-
if (red.complexType) for (const ct of red.complexType) children.push(buildTopLevelComplexType(ct, childCtx));
|
|
995
|
-
if (red.group) for (const grp of red.group) children.push(buildNamedGroup(grp, childCtx));
|
|
996
|
-
if (red.attributeGroup) for (const ag of red.attributeGroup) children.push(buildNamedAttributeGroup(ag, childCtx));
|
|
997
|
-
return buildElement(`${ctx.prefix}:redefine`, attrs, children, ctx);
|
|
998
|
-
}
|
|
999
|
-
function buildOverride(ovr, ctx) {
|
|
1000
|
-
const attrs = [];
|
|
1001
|
-
addAttr(attrs, "id", ovr.id);
|
|
1002
|
-
addAttr(attrs, "schemaLocation", ovr.schemaLocation);
|
|
1003
|
-
const children = [];
|
|
1004
|
-
const childCtx = {
|
|
1005
|
-
...ctx,
|
|
1006
|
-
level: ctx.level + 1
|
|
1007
|
-
};
|
|
1008
|
-
if (ovr.annotation) for (const ann of ovr.annotation) children.push(buildAnnotation(ann, childCtx));
|
|
1009
|
-
if (ovr.simpleType) for (const st of ovr.simpleType) children.push(buildTopLevelSimpleType(st, childCtx));
|
|
1010
|
-
if (ovr.complexType) for (const ct of ovr.complexType) children.push(buildTopLevelComplexType(ct, childCtx));
|
|
1011
|
-
if (ovr.group) for (const grp of ovr.group) children.push(buildNamedGroup(grp, childCtx));
|
|
1012
|
-
if (ovr.attributeGroup) for (const ag of ovr.attributeGroup) children.push(buildNamedAttributeGroup(ag, childCtx));
|
|
1013
|
-
if (ovr.element) for (const el of ovr.element) children.push(buildTopLevelElement(el, childCtx));
|
|
1014
|
-
if (ovr.attribute) for (const attr of ovr.attribute) children.push(buildTopLevelAttribute(attr, childCtx));
|
|
1015
|
-
if (ovr.notation) for (const not of ovr.notation) children.push(buildNotation(not, childCtx));
|
|
1016
|
-
return buildElement(`${ctx.prefix}:override`, attrs, children, ctx);
|
|
1017
|
-
}
|
|
1018
|
-
function buildTopLevelElement(el, ctx) {
|
|
1019
|
-
const attrs = [];
|
|
1020
|
-
addAttr(attrs, "id", el.id);
|
|
1021
|
-
addAttr(attrs, "name", el.name);
|
|
1022
|
-
addAttr(attrs, "type", el.type);
|
|
1023
|
-
addAttr(attrs, "substitutionGroup", el.substitutionGroup);
|
|
1024
|
-
addAttr(attrs, "default", el.default);
|
|
1025
|
-
addAttr(attrs, "fixed", el.fixed);
|
|
1026
|
-
addBoolAttr(attrs, "nillable", el.nillable);
|
|
1027
|
-
addBoolAttr(attrs, "abstract", el.abstract);
|
|
1028
|
-
addAttr(attrs, "final", el.final);
|
|
1029
|
-
addAttr(attrs, "block", el.block);
|
|
1030
|
-
const children = [];
|
|
1031
|
-
const childCtx = {
|
|
1032
|
-
...ctx,
|
|
1033
|
-
level: ctx.level + 1
|
|
1034
|
-
};
|
|
1035
|
-
if (el.annotation) children.push(buildAnnotation(el.annotation, childCtx));
|
|
1036
|
-
if (el.simpleType) children.push(buildLocalSimpleType(el.simpleType, childCtx));
|
|
1037
|
-
if (el.complexType) children.push(buildLocalComplexType(el.complexType, childCtx));
|
|
1038
|
-
if (el.alternative) for (const alt of el.alternative) children.push(buildAlternative(alt, childCtx));
|
|
1039
|
-
if (el.unique) for (const u of el.unique) children.push(buildUnique(u, childCtx));
|
|
1040
|
-
if (el.key) for (const k of el.key) children.push(buildKey(k, childCtx));
|
|
1041
|
-
if (el.keyref) for (const kr of el.keyref) children.push(buildKeyref(kr, childCtx));
|
|
1042
|
-
return buildElement(`${ctx.prefix}:element`, attrs, children, ctx);
|
|
1043
|
-
}
|
|
1044
|
-
function buildLocalElement(el, ctx) {
|
|
1045
|
-
const attrs = [];
|
|
1046
|
-
addAttr(attrs, "id", el.id);
|
|
1047
|
-
addAttr(attrs, "name", el.name);
|
|
1048
|
-
addAttr(attrs, "ref", el.ref);
|
|
1049
|
-
addAttr(attrs, "type", el.type);
|
|
1050
|
-
addOccursAttr(attrs, "minOccurs", el.minOccurs);
|
|
1051
|
-
addOccursAttr(attrs, "maxOccurs", el.maxOccurs);
|
|
1052
|
-
addAttr(attrs, "default", el.default);
|
|
1053
|
-
addAttr(attrs, "fixed", el.fixed);
|
|
1054
|
-
addBoolAttr(attrs, "nillable", el.nillable);
|
|
1055
|
-
addAttr(attrs, "block", el.block);
|
|
1056
|
-
addAttr(attrs, "form", el.form);
|
|
1057
|
-
addAttr(attrs, "targetNamespace", el.targetNamespace);
|
|
1058
|
-
const children = [];
|
|
1059
|
-
const childCtx = {
|
|
1060
|
-
...ctx,
|
|
1061
|
-
level: ctx.level + 1
|
|
1062
|
-
};
|
|
1063
|
-
if (el.annotation) children.push(buildAnnotation(el.annotation, childCtx));
|
|
1064
|
-
if (el.simpleType) children.push(buildLocalSimpleType(el.simpleType, childCtx));
|
|
1065
|
-
if (el.complexType) children.push(buildLocalComplexType(el.complexType, childCtx));
|
|
1066
|
-
if (el.alternative) for (const alt of el.alternative) children.push(buildAlternative(alt, childCtx));
|
|
1067
|
-
if (el.unique) for (const u of el.unique) children.push(buildUnique(u, childCtx));
|
|
1068
|
-
if (el.key) for (const k of el.key) children.push(buildKey(k, childCtx));
|
|
1069
|
-
if (el.keyref) for (const kr of el.keyref) children.push(buildKeyref(kr, childCtx));
|
|
1070
|
-
return buildElement(`${ctx.prefix}:element`, attrs, children, ctx);
|
|
1071
|
-
}
|
|
1072
|
-
function buildTopLevelAttribute(attr, ctx) {
|
|
1073
|
-
const attrs = [];
|
|
1074
|
-
addAttr(attrs, "id", attr.id);
|
|
1075
|
-
addAttr(attrs, "name", attr.name);
|
|
1076
|
-
addAttr(attrs, "type", attr.type);
|
|
1077
|
-
addAttr(attrs, "default", attr.default);
|
|
1078
|
-
addAttr(attrs, "fixed", attr.fixed);
|
|
1079
|
-
addBoolAttr(attrs, "inheritable", attr.inheritable);
|
|
1080
|
-
const children = [];
|
|
1081
|
-
const childCtx = {
|
|
1082
|
-
...ctx,
|
|
1083
|
-
level: ctx.level + 1
|
|
1084
|
-
};
|
|
1085
|
-
if (attr.annotation) children.push(buildAnnotation(attr.annotation, childCtx));
|
|
1086
|
-
if (attr.simpleType) children.push(buildLocalSimpleType(attr.simpleType, childCtx));
|
|
1087
|
-
return buildElement(`${ctx.prefix}:attribute`, attrs, children, ctx);
|
|
1088
|
-
}
|
|
1089
|
-
function buildLocalAttribute(attr, ctx) {
|
|
1090
|
-
const attrs = [];
|
|
1091
|
-
addAttr(attrs, "id", attr.id);
|
|
1092
|
-
addAttr(attrs, "name", attr.name);
|
|
1093
|
-
addAttr(attrs, "ref", attr.ref);
|
|
1094
|
-
addAttr(attrs, "type", attr.type);
|
|
1095
|
-
addAttr(attrs, "use", attr.use);
|
|
1096
|
-
addAttr(attrs, "default", attr.default);
|
|
1097
|
-
addAttr(attrs, "fixed", attr.fixed);
|
|
1098
|
-
addAttr(attrs, "form", attr.form);
|
|
1099
|
-
addAttr(attrs, "targetNamespace", attr.targetNamespace);
|
|
1100
|
-
addBoolAttr(attrs, "inheritable", attr.inheritable);
|
|
1101
|
-
const children = [];
|
|
1102
|
-
const childCtx = {
|
|
1103
|
-
...ctx,
|
|
1104
|
-
level: ctx.level + 1
|
|
1105
|
-
};
|
|
1106
|
-
if (attr.annotation) children.push(buildAnnotation(attr.annotation, childCtx));
|
|
1107
|
-
if (attr.simpleType) children.push(buildLocalSimpleType(attr.simpleType, childCtx));
|
|
1108
|
-
return buildElement(`${ctx.prefix}:attribute`, attrs, children, ctx);
|
|
1109
|
-
}
|
|
1110
|
-
function buildTopLevelComplexType(ct, ctx) {
|
|
1111
|
-
const attrs = [];
|
|
1112
|
-
addAttr(attrs, "id", ct.id);
|
|
1113
|
-
addAttr(attrs, "name", ct.name);
|
|
1114
|
-
addBoolAttr(attrs, "mixed", ct.mixed);
|
|
1115
|
-
addBoolAttr(attrs, "abstract", ct.abstract);
|
|
1116
|
-
addAttr(attrs, "final", ct.final);
|
|
1117
|
-
addAttr(attrs, "block", ct.block);
|
|
1118
|
-
addBoolAttr(attrs, "defaultAttributesApply", ct.defaultAttributesApply);
|
|
1119
|
-
return buildComplexTypeContent(ct, attrs, ctx);
|
|
1120
|
-
}
|
|
1121
|
-
function buildLocalComplexType(ct, ctx) {
|
|
1122
|
-
const attrs = [];
|
|
1123
|
-
addAttr(attrs, "id", ct.id);
|
|
1124
|
-
addBoolAttr(attrs, "mixed", ct.mixed);
|
|
1125
|
-
return buildComplexTypeContent(ct, attrs, ctx);
|
|
1126
|
-
}
|
|
1127
|
-
function buildComplexTypeContent(ct, attrs, ctx) {
|
|
1128
|
-
const children = [];
|
|
1129
|
-
const childCtx = {
|
|
1130
|
-
...ctx,
|
|
1131
|
-
level: ctx.level + 1
|
|
1132
|
-
};
|
|
1133
|
-
if (ct.annotation) children.push(buildAnnotation(ct.annotation, childCtx));
|
|
1134
|
-
if (ct.simpleContent) children.push(buildSimpleContent(ct.simpleContent, childCtx));
|
|
1135
|
-
else if (ct.complexContent) children.push(buildComplexContent(ct.complexContent, childCtx));
|
|
1136
|
-
else {
|
|
1137
|
-
if (ct.openContent) children.push(buildOpenContent(ct.openContent, childCtx));
|
|
1138
|
-
if (ct.group) children.push(buildGroupRef(ct.group, childCtx));
|
|
1139
|
-
if (ct.all) children.push(buildAll(ct.all, childCtx));
|
|
1140
|
-
if (ct.choice) children.push(buildExplicitGroup(ct.choice, "choice", childCtx));
|
|
1141
|
-
if (ct.sequence) children.push(buildExplicitGroup(ct.sequence, "sequence", childCtx));
|
|
1142
|
-
if (ct.attribute) for (const attr of ct.attribute) children.push(buildLocalAttribute(attr, childCtx));
|
|
1143
|
-
if (ct.attributeGroup) for (const ag of ct.attributeGroup) children.push(buildAttributeGroupRef(ag, childCtx));
|
|
1144
|
-
if (ct.anyAttribute) children.push(buildAnyAttribute(ct.anyAttribute, childCtx));
|
|
1145
|
-
if (ct.assert) for (const a of ct.assert) children.push(buildAssertion(a, childCtx));
|
|
1146
|
-
}
|
|
1147
|
-
return buildElement(`${ctx.prefix}:complexType`, attrs, children, ctx);
|
|
1148
|
-
}
|
|
1149
|
-
function buildTopLevelSimpleType(st, ctx) {
|
|
1150
|
-
const attrs = [];
|
|
1151
|
-
addAttr(attrs, "id", st.id);
|
|
1152
|
-
addAttr(attrs, "name", st.name);
|
|
1153
|
-
addAttr(attrs, "final", st.final);
|
|
1154
|
-
return buildSimpleTypeContent(st, attrs, ctx);
|
|
1155
|
-
}
|
|
1156
|
-
function buildLocalSimpleType(st, ctx) {
|
|
1157
|
-
const attrs = [];
|
|
1158
|
-
addAttr(attrs, "id", st.id);
|
|
1159
|
-
return buildSimpleTypeContent(st, attrs, ctx);
|
|
1160
|
-
}
|
|
1161
|
-
function buildSimpleTypeContent(st, attrs, ctx) {
|
|
1162
|
-
const children = [];
|
|
1163
|
-
const childCtx = {
|
|
1164
|
-
...ctx,
|
|
1165
|
-
level: ctx.level + 1
|
|
1166
|
-
};
|
|
1167
|
-
if (st.annotation) children.push(buildAnnotation(st.annotation, childCtx));
|
|
1168
|
-
if (st.restriction) children.push(buildSimpleTypeRestriction(st.restriction, childCtx));
|
|
1169
|
-
else if (st.list) children.push(buildList(st.list, childCtx));
|
|
1170
|
-
else if (st.union) children.push(buildUnion(st.union, childCtx));
|
|
1171
|
-
return buildElement(`${ctx.prefix}:simpleType`, attrs, children, ctx);
|
|
1172
|
-
}
|
|
1173
|
-
function buildSimpleTypeRestriction(r, ctx) {
|
|
1174
|
-
const attrs = [];
|
|
1175
|
-
addAttr(attrs, "id", r.id);
|
|
1176
|
-
addAttr(attrs, "base", r.base);
|
|
1177
|
-
const children = [];
|
|
1178
|
-
const childCtx = {
|
|
1179
|
-
...ctx,
|
|
1180
|
-
level: ctx.level + 1
|
|
1181
|
-
};
|
|
1182
|
-
if (r.annotation) children.push(buildAnnotation(r.annotation, childCtx));
|
|
1183
|
-
if (r.simpleType) children.push(buildLocalSimpleType(r.simpleType, childCtx));
|
|
1184
|
-
buildFacets(r, children, childCtx);
|
|
1185
|
-
return buildElement(`${ctx.prefix}:restriction`, attrs, children, ctx);
|
|
1186
|
-
}
|
|
1187
|
-
function buildFacets(r, children, ctx) {
|
|
1188
|
-
if (r.minExclusive) for (const f of r.minExclusive) children.push(buildFacet(f, "minExclusive", ctx));
|
|
1189
|
-
if (r.minInclusive) for (const f of r.minInclusive) children.push(buildFacet(f, "minInclusive", ctx));
|
|
1190
|
-
if (r.maxExclusive) for (const f of r.maxExclusive) children.push(buildFacet(f, "maxExclusive", ctx));
|
|
1191
|
-
if (r.maxInclusive) for (const f of r.maxInclusive) children.push(buildFacet(f, "maxInclusive", ctx));
|
|
1192
|
-
if (r.totalDigits) for (const f of r.totalDigits) children.push(buildFacet(f, "totalDigits", ctx));
|
|
1193
|
-
if (r.fractionDigits) for (const f of r.fractionDigits) children.push(buildFacet(f, "fractionDigits", ctx));
|
|
1194
|
-
if (r.length) for (const f of r.length) children.push(buildFacet(f, "length", ctx));
|
|
1195
|
-
if (r.minLength) for (const f of r.minLength) children.push(buildFacet(f, "minLength", ctx));
|
|
1196
|
-
if (r.maxLength) for (const f of r.maxLength) children.push(buildFacet(f, "maxLength", ctx));
|
|
1197
|
-
if (r.enumeration) for (const f of r.enumeration) children.push(buildFacet(f, "enumeration", ctx));
|
|
1198
|
-
if (r.whiteSpace) for (const f of r.whiteSpace) children.push(buildFacet(f, "whiteSpace", ctx));
|
|
1199
|
-
if (r.pattern) for (const p of r.pattern) children.push(buildPattern(p, ctx));
|
|
1200
|
-
if (r.assertion) for (const a of r.assertion) children.push(buildAssertion(a, ctx));
|
|
1201
|
-
if (r.explicitTimezone) for (const f of r.explicitTimezone) children.push(buildFacet(f, "explicitTimezone", ctx));
|
|
1202
|
-
}
|
|
1203
|
-
function buildFacet(f, name, ctx) {
|
|
1204
|
-
const attrs = [];
|
|
1205
|
-
addAttr(attrs, "id", f.id);
|
|
1206
|
-
addAttr(attrs, "value", f.value);
|
|
1207
|
-
addBoolAttr(attrs, "fixed", f.fixed);
|
|
1208
|
-
const children = [];
|
|
1209
|
-
if (f.annotation) children.push(buildAnnotation(f.annotation, {
|
|
1210
|
-
...ctx,
|
|
1211
|
-
level: ctx.level + 1
|
|
1212
|
-
}));
|
|
1213
|
-
return buildElement(`${ctx.prefix}:${name}`, attrs, children, ctx);
|
|
1214
|
-
}
|
|
1215
|
-
function buildPattern(p, ctx) {
|
|
1216
|
-
const attrs = [];
|
|
1217
|
-
addAttr(attrs, "id", p.id);
|
|
1218
|
-
addAttr(attrs, "value", p.value);
|
|
1219
|
-
const children = [];
|
|
1220
|
-
if (p.annotation) children.push(buildAnnotation(p.annotation, {
|
|
1221
|
-
...ctx,
|
|
1222
|
-
level: ctx.level + 1
|
|
1223
|
-
}));
|
|
1224
|
-
return buildElement(`${ctx.prefix}:pattern`, attrs, children, ctx);
|
|
1225
|
-
}
|
|
1226
|
-
function buildList(l, ctx) {
|
|
1227
|
-
const attrs = [];
|
|
1228
|
-
addAttr(attrs, "id", l.id);
|
|
1229
|
-
addAttr(attrs, "itemType", l.itemType);
|
|
1230
|
-
const children = [];
|
|
1231
|
-
const childCtx = {
|
|
1232
|
-
...ctx,
|
|
1233
|
-
level: ctx.level + 1
|
|
1234
|
-
};
|
|
1235
|
-
if (l.annotation) children.push(buildAnnotation(l.annotation, childCtx));
|
|
1236
|
-
if (l.simpleType) children.push(buildLocalSimpleType(l.simpleType, childCtx));
|
|
1237
|
-
return buildElement(`${ctx.prefix}:list`, attrs, children, ctx);
|
|
1238
|
-
}
|
|
1239
|
-
function buildUnion(u, ctx) {
|
|
1240
|
-
const attrs = [];
|
|
1241
|
-
addAttr(attrs, "id", u.id);
|
|
1242
|
-
addAttr(attrs, "memberTypes", u.memberTypes);
|
|
1243
|
-
const children = [];
|
|
1244
|
-
const childCtx = {
|
|
1245
|
-
...ctx,
|
|
1246
|
-
level: ctx.level + 1
|
|
1247
|
-
};
|
|
1248
|
-
if (u.annotation) children.push(buildAnnotation(u.annotation, childCtx));
|
|
1249
|
-
if (u.simpleType) for (const st of u.simpleType) children.push(buildLocalSimpleType(st, childCtx));
|
|
1250
|
-
return buildElement(`${ctx.prefix}:union`, attrs, children, ctx);
|
|
1251
|
-
}
|
|
1252
|
-
function buildComplexContent(cc, ctx) {
|
|
1253
|
-
const attrs = [];
|
|
1254
|
-
addAttr(attrs, "id", cc.id);
|
|
1255
|
-
addBoolAttr(attrs, "mixed", cc.mixed);
|
|
1256
|
-
const children = [];
|
|
1257
|
-
const childCtx = {
|
|
1258
|
-
...ctx,
|
|
1259
|
-
level: ctx.level + 1
|
|
1260
|
-
};
|
|
1261
|
-
if (cc.annotation) children.push(buildAnnotation(cc.annotation, childCtx));
|
|
1262
|
-
if (cc.restriction) children.push(buildComplexContentRestriction(cc.restriction, childCtx));
|
|
1263
|
-
else if (cc.extension) children.push(buildComplexContentExtension(cc.extension, childCtx));
|
|
1264
|
-
return buildElement(`${ctx.prefix}:complexContent`, attrs, children, ctx);
|
|
1265
|
-
}
|
|
1266
|
-
function buildSimpleContent(sc, ctx) {
|
|
1267
|
-
const attrs = [];
|
|
1268
|
-
addAttr(attrs, "id", sc.id);
|
|
1269
|
-
const children = [];
|
|
1270
|
-
const childCtx = {
|
|
1271
|
-
...ctx,
|
|
1272
|
-
level: ctx.level + 1
|
|
1273
|
-
};
|
|
1274
|
-
if (sc.annotation) children.push(buildAnnotation(sc.annotation, childCtx));
|
|
1275
|
-
if (sc.restriction) children.push(buildSimpleContentRestriction(sc.restriction, childCtx));
|
|
1276
|
-
else if (sc.extension) children.push(buildSimpleContentExtension(sc.extension, childCtx));
|
|
1277
|
-
return buildElement(`${ctx.prefix}:simpleContent`, attrs, children, ctx);
|
|
1278
|
-
}
|
|
1279
|
-
function buildComplexContentRestriction(r, ctx) {
|
|
1280
|
-
const attrs = [];
|
|
1281
|
-
addAttr(attrs, "id", r.id);
|
|
1282
|
-
addAttr(attrs, "base", r.base);
|
|
1283
|
-
const children = [];
|
|
1284
|
-
const childCtx = {
|
|
1285
|
-
...ctx,
|
|
1286
|
-
level: ctx.level + 1
|
|
1287
|
-
};
|
|
1288
|
-
if (r.annotation) children.push(buildAnnotation(r.annotation, childCtx));
|
|
1289
|
-
if (r.openContent) children.push(buildOpenContent(r.openContent, childCtx));
|
|
1290
|
-
if (r.group) children.push(buildGroupRef(r.group, childCtx));
|
|
1291
|
-
if (r.all) children.push(buildAll(r.all, childCtx));
|
|
1292
|
-
if (r.choice) children.push(buildExplicitGroup(r.choice, "choice", childCtx));
|
|
1293
|
-
if (r.sequence) children.push(buildExplicitGroup(r.sequence, "sequence", childCtx));
|
|
1294
|
-
if (r.attribute) for (const attr of r.attribute) children.push(buildLocalAttribute(attr, childCtx));
|
|
1295
|
-
if (r.attributeGroup) for (const ag of r.attributeGroup) children.push(buildAttributeGroupRef(ag, childCtx));
|
|
1296
|
-
if (r.anyAttribute) children.push(buildAnyAttribute(r.anyAttribute, childCtx));
|
|
1297
|
-
if (r.assert) for (const a of r.assert) children.push(buildAssertion(a, childCtx));
|
|
1298
|
-
return buildElement(`${ctx.prefix}:restriction`, attrs, children, ctx);
|
|
1299
|
-
}
|
|
1300
|
-
function buildComplexContentExtension(e, ctx) {
|
|
1301
|
-
const attrs = [];
|
|
1302
|
-
addAttr(attrs, "id", e.id);
|
|
1303
|
-
addAttr(attrs, "base", e.base);
|
|
1304
|
-
const children = [];
|
|
1305
|
-
const childCtx = {
|
|
1306
|
-
...ctx,
|
|
1307
|
-
level: ctx.level + 1
|
|
1308
|
-
};
|
|
1309
|
-
if (e.annotation) children.push(buildAnnotation(e.annotation, childCtx));
|
|
1310
|
-
if (e.openContent) children.push(buildOpenContent(e.openContent, childCtx));
|
|
1311
|
-
if (e.group) children.push(buildGroupRef(e.group, childCtx));
|
|
1312
|
-
if (e.all) children.push(buildAll(e.all, childCtx));
|
|
1313
|
-
if (e.choice) children.push(buildExplicitGroup(e.choice, "choice", childCtx));
|
|
1314
|
-
if (e.sequence) children.push(buildExplicitGroup(e.sequence, "sequence", childCtx));
|
|
1315
|
-
if (e.attribute) for (const attr of e.attribute) children.push(buildLocalAttribute(attr, childCtx));
|
|
1316
|
-
if (e.attributeGroup) for (const ag of e.attributeGroup) children.push(buildAttributeGroupRef(ag, childCtx));
|
|
1317
|
-
if (e.anyAttribute) children.push(buildAnyAttribute(e.anyAttribute, childCtx));
|
|
1318
|
-
if (e.assert) for (const a of e.assert) children.push(buildAssertion(a, childCtx));
|
|
1319
|
-
return buildElement(`${ctx.prefix}:extension`, attrs, children, ctx);
|
|
1320
|
-
}
|
|
1321
|
-
function buildSimpleContentRestriction(r, ctx) {
|
|
1322
|
-
const attrs = [];
|
|
1323
|
-
addAttr(attrs, "id", r.id);
|
|
1324
|
-
addAttr(attrs, "base", r.base);
|
|
1325
|
-
const children = [];
|
|
1326
|
-
const childCtx = {
|
|
1327
|
-
...ctx,
|
|
1328
|
-
level: ctx.level + 1
|
|
1329
|
-
};
|
|
1330
|
-
if (r.annotation) children.push(buildAnnotation(r.annotation, childCtx));
|
|
1331
|
-
if (r.simpleType) children.push(buildLocalSimpleType(r.simpleType, childCtx));
|
|
1332
|
-
buildFacets(r, children, childCtx);
|
|
1333
|
-
if (r.attribute) for (const attr of r.attribute) children.push(buildLocalAttribute(attr, childCtx));
|
|
1334
|
-
if (r.attributeGroup) for (const ag of r.attributeGroup) children.push(buildAttributeGroupRef(ag, childCtx));
|
|
1335
|
-
if (r.anyAttribute) children.push(buildAnyAttribute(r.anyAttribute, childCtx));
|
|
1336
|
-
if (r.assert) for (const a of r.assert) children.push(buildAssertion(a, childCtx));
|
|
1337
|
-
return buildElement(`${ctx.prefix}:restriction`, attrs, children, ctx);
|
|
1338
|
-
}
|
|
1339
|
-
function buildSimpleContentExtension(e, ctx) {
|
|
1340
|
-
const attrs = [];
|
|
1341
|
-
addAttr(attrs, "id", e.id);
|
|
1342
|
-
addAttr(attrs, "base", e.base);
|
|
1343
|
-
const children = [];
|
|
1344
|
-
const childCtx = {
|
|
1345
|
-
...ctx,
|
|
1346
|
-
level: ctx.level + 1
|
|
1347
|
-
};
|
|
1348
|
-
if (e.annotation) children.push(buildAnnotation(e.annotation, childCtx));
|
|
1349
|
-
if (e.attribute) for (const attr of e.attribute) children.push(buildLocalAttribute(attr, childCtx));
|
|
1350
|
-
if (e.attributeGroup) for (const ag of e.attributeGroup) children.push(buildAttributeGroupRef(ag, childCtx));
|
|
1351
|
-
if (e.anyAttribute) children.push(buildAnyAttribute(e.anyAttribute, childCtx));
|
|
1352
|
-
if (e.assert) for (const a of e.assert) children.push(buildAssertion(a, childCtx));
|
|
1353
|
-
return buildElement(`${ctx.prefix}:extension`, attrs, children, ctx);
|
|
1354
|
-
}
|
|
1355
|
-
function buildExplicitGroup(g, name, ctx) {
|
|
1356
|
-
const attrs = [];
|
|
1357
|
-
addAttr(attrs, "id", g.id);
|
|
1358
|
-
addOccursAttr(attrs, "minOccurs", g.minOccurs);
|
|
1359
|
-
addOccursAttr(attrs, "maxOccurs", g.maxOccurs);
|
|
1360
|
-
const children = [];
|
|
1361
|
-
const childCtx = {
|
|
1362
|
-
...ctx,
|
|
1363
|
-
level: ctx.level + 1
|
|
1364
|
-
};
|
|
1365
|
-
if (g.annotation) children.push(buildAnnotation(g.annotation, childCtx));
|
|
1366
|
-
if (g.element) for (const el of g.element) children.push(buildLocalElement(el, childCtx));
|
|
1367
|
-
if (g.group) for (const grp of g.group) children.push(buildGroupRef(grp, childCtx));
|
|
1368
|
-
if (g.choice) for (const c of g.choice) children.push(buildExplicitGroup(c, "choice", childCtx));
|
|
1369
|
-
if (g.sequence) for (const s of g.sequence) children.push(buildExplicitGroup(s, "sequence", childCtx));
|
|
1370
|
-
if (g.any) for (const a of g.any) children.push(buildAny(a, childCtx));
|
|
1371
|
-
return buildElement(`${ctx.prefix}:${name}`, attrs, children, ctx);
|
|
1372
|
-
}
|
|
1373
|
-
function buildAll(a, ctx) {
|
|
1374
|
-
const attrs = [];
|
|
1375
|
-
addAttr(attrs, "id", a.id);
|
|
1376
|
-
addOccursAttr(attrs, "minOccurs", a.minOccurs);
|
|
1377
|
-
addOccursAttr(attrs, "maxOccurs", a.maxOccurs);
|
|
1378
|
-
const children = [];
|
|
1379
|
-
const childCtx = {
|
|
1380
|
-
...ctx,
|
|
1381
|
-
level: ctx.level + 1
|
|
1382
|
-
};
|
|
1383
|
-
if (a.annotation) children.push(buildAnnotation(a.annotation, childCtx));
|
|
1384
|
-
if (a.element) for (const el of a.element) children.push(buildLocalElement(el, childCtx));
|
|
1385
|
-
if (a.any) for (const any of a.any) children.push(buildAny(any, childCtx));
|
|
1386
|
-
if (a.group) for (const grp of a.group) children.push(buildGroupRef(grp, childCtx));
|
|
1387
|
-
return buildElement(`${ctx.prefix}:all`, attrs, children, ctx);
|
|
1388
|
-
}
|
|
1389
|
-
function buildNamedGroup(g, ctx) {
|
|
1390
|
-
const attrs = [];
|
|
1391
|
-
addAttr(attrs, "id", g.id);
|
|
1392
|
-
addAttr(attrs, "name", g.name);
|
|
1393
|
-
const children = [];
|
|
1394
|
-
const childCtx = {
|
|
1395
|
-
...ctx,
|
|
1396
|
-
level: ctx.level + 1
|
|
1397
|
-
};
|
|
1398
|
-
if (g.annotation) children.push(buildAnnotation(g.annotation, childCtx));
|
|
1399
|
-
if (g.all) children.push(buildAll(g.all, childCtx));
|
|
1400
|
-
if (g.choice) children.push(buildExplicitGroup(g.choice, "choice", childCtx));
|
|
1401
|
-
if (g.sequence) children.push(buildExplicitGroup(g.sequence, "sequence", childCtx));
|
|
1402
|
-
return buildElement(`${ctx.prefix}:group`, attrs, children, ctx);
|
|
1403
|
-
}
|
|
1404
|
-
function buildGroupRef(g, ctx) {
|
|
1405
|
-
const attrs = [];
|
|
1406
|
-
addAttr(attrs, "id", g.id);
|
|
1407
|
-
addAttr(attrs, "ref", g.ref);
|
|
1408
|
-
addOccursAttr(attrs, "minOccurs", g.minOccurs);
|
|
1409
|
-
addOccursAttr(attrs, "maxOccurs", g.maxOccurs);
|
|
1410
|
-
const children = [];
|
|
1411
|
-
if (g.annotation) children.push(buildAnnotation(g.annotation, {
|
|
1412
|
-
...ctx,
|
|
1413
|
-
level: ctx.level + 1
|
|
1414
|
-
}));
|
|
1415
|
-
return buildElement(`${ctx.prefix}:group`, attrs, children, ctx);
|
|
1416
|
-
}
|
|
1417
|
-
function buildNamedAttributeGroup(ag, ctx) {
|
|
1418
|
-
const attrs = [];
|
|
1419
|
-
addAttr(attrs, "id", ag.id);
|
|
1420
|
-
addAttr(attrs, "name", ag.name);
|
|
1421
|
-
const children = [];
|
|
1422
|
-
const childCtx = {
|
|
1423
|
-
...ctx,
|
|
1424
|
-
level: ctx.level + 1
|
|
1425
|
-
};
|
|
1426
|
-
if (ag.annotation) children.push(buildAnnotation(ag.annotation, childCtx));
|
|
1427
|
-
if (ag.attribute) for (const attr of ag.attribute) children.push(buildLocalAttribute(attr, childCtx));
|
|
1428
|
-
if (ag.attributeGroup) for (const agr of ag.attributeGroup) children.push(buildAttributeGroupRef(agr, childCtx));
|
|
1429
|
-
if (ag.anyAttribute) children.push(buildAnyAttribute(ag.anyAttribute, childCtx));
|
|
1430
|
-
return buildElement(`${ctx.prefix}:attributeGroup`, attrs, children, ctx);
|
|
1431
|
-
}
|
|
1432
|
-
function buildAttributeGroupRef(ag, ctx) {
|
|
1433
|
-
const attrs = [];
|
|
1434
|
-
addAttr(attrs, "id", ag.id);
|
|
1435
|
-
addAttr(attrs, "ref", ag.ref);
|
|
1436
|
-
const children = [];
|
|
1437
|
-
if (ag.annotation) children.push(buildAnnotation(ag.annotation, {
|
|
1438
|
-
...ctx,
|
|
1439
|
-
level: ctx.level + 1
|
|
1440
|
-
}));
|
|
1441
|
-
return buildElement(`${ctx.prefix}:attributeGroup`, attrs, children, ctx);
|
|
1442
|
-
}
|
|
1443
|
-
function buildAny(a, ctx) {
|
|
1444
|
-
const attrs = [];
|
|
1445
|
-
addAttr(attrs, "id", a.id);
|
|
1446
|
-
addOccursAttr(attrs, "minOccurs", a.minOccurs);
|
|
1447
|
-
addOccursAttr(attrs, "maxOccurs", a.maxOccurs);
|
|
1448
|
-
addAttr(attrs, "namespace", a.namespace);
|
|
1449
|
-
addAttr(attrs, "processContents", a.processContents);
|
|
1450
|
-
addAttr(attrs, "notNamespace", a.notNamespace);
|
|
1451
|
-
addAttr(attrs, "notQName", a.notQName);
|
|
1452
|
-
const children = [];
|
|
1453
|
-
if (a.annotation) children.push(buildAnnotation(a.annotation, {
|
|
1454
|
-
...ctx,
|
|
1455
|
-
level: ctx.level + 1
|
|
1456
|
-
}));
|
|
1457
|
-
return buildElement(`${ctx.prefix}:any`, attrs, children, ctx);
|
|
1458
|
-
}
|
|
1459
|
-
function buildAnyAttribute(aa, ctx) {
|
|
1460
|
-
const attrs = [];
|
|
1461
|
-
addAttr(attrs, "id", aa.id);
|
|
1462
|
-
addAttr(attrs, "namespace", aa.namespace);
|
|
1463
|
-
addAttr(attrs, "processContents", aa.processContents);
|
|
1464
|
-
addAttr(attrs, "notNamespace", aa.notNamespace);
|
|
1465
|
-
addAttr(attrs, "notQName", aa.notQName);
|
|
1466
|
-
const children = [];
|
|
1467
|
-
if (aa.annotation) children.push(buildAnnotation(aa.annotation, {
|
|
1468
|
-
...ctx,
|
|
1469
|
-
level: ctx.level + 1
|
|
1470
|
-
}));
|
|
1471
|
-
return buildElement(`${ctx.prefix}:anyAttribute`, attrs, children, ctx);
|
|
1472
|
-
}
|
|
1473
|
-
function buildUnique(u, ctx) {
|
|
1474
|
-
const attrs = [];
|
|
1475
|
-
addAttr(attrs, "id", u.id);
|
|
1476
|
-
addAttr(attrs, "name", u.name);
|
|
1477
|
-
addAttr(attrs, "ref", u.ref);
|
|
1478
|
-
const children = [];
|
|
1479
|
-
const childCtx = {
|
|
1480
|
-
...ctx,
|
|
1481
|
-
level: ctx.level + 1
|
|
1482
|
-
};
|
|
1483
|
-
if (u.annotation) children.push(buildAnnotation(u.annotation, childCtx));
|
|
1484
|
-
if (u.selector) children.push(buildSelector(u.selector, childCtx));
|
|
1485
|
-
if (u.field) for (const f of u.field) children.push(buildField(f, childCtx));
|
|
1486
|
-
return buildElement(`${ctx.prefix}:unique`, attrs, children, ctx);
|
|
1487
|
-
}
|
|
1488
|
-
function buildKey(k, ctx) {
|
|
1489
|
-
const attrs = [];
|
|
1490
|
-
addAttr(attrs, "id", k.id);
|
|
1491
|
-
addAttr(attrs, "name", k.name);
|
|
1492
|
-
addAttr(attrs, "ref", k.ref);
|
|
1493
|
-
const children = [];
|
|
1494
|
-
const childCtx = {
|
|
1495
|
-
...ctx,
|
|
1496
|
-
level: ctx.level + 1
|
|
1497
|
-
};
|
|
1498
|
-
if (k.annotation) children.push(buildAnnotation(k.annotation, childCtx));
|
|
1499
|
-
if (k.selector) children.push(buildSelector(k.selector, childCtx));
|
|
1500
|
-
if (k.field) for (const f of k.field) children.push(buildField(f, childCtx));
|
|
1501
|
-
return buildElement(`${ctx.prefix}:key`, attrs, children, ctx);
|
|
1502
|
-
}
|
|
1503
|
-
function buildKeyref(kr, ctx) {
|
|
1504
|
-
const attrs = [];
|
|
1505
|
-
addAttr(attrs, "id", kr.id);
|
|
1506
|
-
addAttr(attrs, "name", kr.name);
|
|
1507
|
-
addAttr(attrs, "ref", kr.ref);
|
|
1508
|
-
addAttr(attrs, "refer", kr.refer);
|
|
1509
|
-
const children = [];
|
|
1510
|
-
const childCtx = {
|
|
1511
|
-
...ctx,
|
|
1512
|
-
level: ctx.level + 1
|
|
1513
|
-
};
|
|
1514
|
-
if (kr.annotation) children.push(buildAnnotation(kr.annotation, childCtx));
|
|
1515
|
-
if (kr.selector) children.push(buildSelector(kr.selector, childCtx));
|
|
1516
|
-
if (kr.field) for (const f of kr.field) children.push(buildField(f, childCtx));
|
|
1517
|
-
return buildElement(`${ctx.prefix}:keyref`, attrs, children, ctx);
|
|
1518
|
-
}
|
|
1519
|
-
function buildSelector(s, ctx) {
|
|
1520
|
-
const attrs = [];
|
|
1521
|
-
addAttr(attrs, "id", s.id);
|
|
1522
|
-
addAttr(attrs, "xpath", s.xpath);
|
|
1523
|
-
addAttr(attrs, "xpathDefaultNamespace", s.xpathDefaultNamespace);
|
|
1524
|
-
const children = [];
|
|
1525
|
-
if (s.annotation) children.push(buildAnnotation(s.annotation, {
|
|
1526
|
-
...ctx,
|
|
1527
|
-
level: ctx.level + 1
|
|
1528
|
-
}));
|
|
1529
|
-
return buildElement(`${ctx.prefix}:selector`, attrs, children, ctx);
|
|
1530
|
-
}
|
|
1531
|
-
function buildField(f, ctx) {
|
|
1532
|
-
const attrs = [];
|
|
1533
|
-
addAttr(attrs, "id", f.id);
|
|
1534
|
-
addAttr(attrs, "xpath", f.xpath);
|
|
1535
|
-
addAttr(attrs, "xpathDefaultNamespace", f.xpathDefaultNamespace);
|
|
1536
|
-
const children = [];
|
|
1537
|
-
if (f.annotation) children.push(buildAnnotation(f.annotation, {
|
|
1538
|
-
...ctx,
|
|
1539
|
-
level: ctx.level + 1
|
|
1540
|
-
}));
|
|
1541
|
-
return buildElement(`${ctx.prefix}:field`, attrs, children, ctx);
|
|
1542
|
-
}
|
|
1543
|
-
function buildOpenContent(oc, ctx) {
|
|
1544
|
-
const attrs = [];
|
|
1545
|
-
addAttr(attrs, "id", oc.id);
|
|
1546
|
-
addAttr(attrs, "mode", oc.mode);
|
|
1547
|
-
const children = [];
|
|
1548
|
-
const childCtx = {
|
|
1549
|
-
...ctx,
|
|
1550
|
-
level: ctx.level + 1
|
|
1551
|
-
};
|
|
1552
|
-
if (oc.annotation) children.push(buildAnnotation(oc.annotation, childCtx));
|
|
1553
|
-
if (oc.any) children.push(buildAny(oc.any, childCtx));
|
|
1554
|
-
return buildElement(`${ctx.prefix}:openContent`, attrs, children, ctx);
|
|
1555
|
-
}
|
|
1556
|
-
function buildDefaultOpenContent(doc, ctx) {
|
|
1557
|
-
const attrs = [];
|
|
1558
|
-
addAttr(attrs, "id", doc.id);
|
|
1559
|
-
addBoolAttr(attrs, "appliesToEmpty", doc.appliesToEmpty);
|
|
1560
|
-
addAttr(attrs, "mode", doc.mode);
|
|
1561
|
-
const children = [];
|
|
1562
|
-
const childCtx = {
|
|
1563
|
-
...ctx,
|
|
1564
|
-
level: ctx.level + 1
|
|
1565
|
-
};
|
|
1566
|
-
if (doc.annotation) children.push(buildAnnotation(doc.annotation, childCtx));
|
|
1567
|
-
children.push(buildAny(doc.any, childCtx));
|
|
1568
|
-
return buildElement(`${ctx.prefix}:defaultOpenContent`, attrs, children, ctx);
|
|
1569
|
-
}
|
|
1570
|
-
function buildAssertion(a, ctx) {
|
|
1571
|
-
const attrs = [];
|
|
1572
|
-
addAttr(attrs, "id", a.id);
|
|
1573
|
-
addAttr(attrs, "test", a.test);
|
|
1574
|
-
addAttr(attrs, "xpathDefaultNamespace", a.xpathDefaultNamespace);
|
|
1575
|
-
const children = [];
|
|
1576
|
-
if (a.annotation) children.push(buildAnnotation(a.annotation, {
|
|
1577
|
-
...ctx,
|
|
1578
|
-
level: ctx.level + 1
|
|
1579
|
-
}));
|
|
1580
|
-
return buildElement(`${ctx.prefix}:assert`, attrs, children, ctx);
|
|
1581
|
-
}
|
|
1582
|
-
function buildAlternative(alt, ctx) {
|
|
1583
|
-
const attrs = [];
|
|
1584
|
-
addAttr(attrs, "id", alt.id);
|
|
1585
|
-
addAttr(attrs, "test", alt.test);
|
|
1586
|
-
addAttr(attrs, "type", alt.type);
|
|
1587
|
-
addAttr(attrs, "xpathDefaultNamespace", alt.xpathDefaultNamespace);
|
|
1588
|
-
const children = [];
|
|
1589
|
-
const childCtx = {
|
|
1590
|
-
...ctx,
|
|
1591
|
-
level: ctx.level + 1
|
|
1592
|
-
};
|
|
1593
|
-
if (alt.annotation) children.push(buildAnnotation(alt.annotation, childCtx));
|
|
1594
|
-
if (alt.simpleType) children.push(buildLocalSimpleType(alt.simpleType, childCtx));
|
|
1595
|
-
if (alt.complexType) children.push(buildLocalComplexType(alt.complexType, childCtx));
|
|
1596
|
-
return buildElement(`${ctx.prefix}:alternative`, attrs, children, ctx);
|
|
1597
|
-
}
|
|
1598
|
-
function buildNotation(n, ctx) {
|
|
1599
|
-
const attrs = [];
|
|
1600
|
-
addAttr(attrs, "id", n.id);
|
|
1601
|
-
addAttr(attrs, "name", n.name);
|
|
1602
|
-
addAttr(attrs, "public", n.public);
|
|
1603
|
-
addAttr(attrs, "system", n.system);
|
|
1604
|
-
const children = [];
|
|
1605
|
-
if (n.annotation) children.push(buildAnnotation(n.annotation, {
|
|
1606
|
-
...ctx,
|
|
1607
|
-
level: ctx.level + 1
|
|
1608
|
-
}));
|
|
1609
|
-
return buildElement(`${ctx.prefix}:notation`, attrs, children, ctx);
|
|
1610
|
-
}
|
|
1611
|
-
function addAttr(attrs, name, value) {
|
|
1612
|
-
if (value !== void 0) attrs.push(`${name}="${escapeXml(value)}"`);
|
|
1613
|
-
}
|
|
1614
|
-
function addBoolAttr(attrs, name, value) {
|
|
1615
|
-
if (value !== void 0) attrs.push(`${name}="${value}"`);
|
|
1616
|
-
}
|
|
1617
|
-
function addOccursAttr(attrs, name, value) {
|
|
1618
|
-
if (value !== void 0) attrs.push(`${name}="${value}"`);
|
|
1619
|
-
}
|
|
1620
|
-
function escapeXml(str) {
|
|
1621
|
-
return str.replaceAll(/&/g, "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
1622
|
-
}
|
|
1623
|
-
function buildElement(tag, attrs, children, ctx) {
|
|
1624
|
-
const indent = ctx.pretty ? ctx.indent.repeat(ctx.level) : "";
|
|
1625
|
-
const attrStr = attrs.length > 0 ? " " + attrs.join(" ") : "";
|
|
1626
|
-
if (children.length === 0) return `${indent}<${tag}${attrStr}/>`;
|
|
1627
|
-
const nl = ctx.pretty ? "\n" : "";
|
|
1628
|
-
return `${indent}<${tag}${attrStr}>${nl}${children.join(nl)}${nl}${indent}</${tag}>`;
|
|
1629
|
-
}
|
|
1630
|
-
function buildElementWithText(tag, attrs, text, ctx) {
|
|
1631
|
-
return `${ctx.pretty ? ctx.indent.repeat(ctx.level) : ""}<${tag}${attrs.length > 0 ? " " + attrs.join(" ") : ""}>${escapeXml(text)}</${tag}>`;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
//#endregion
|
|
1635
|
-
//#region src/xsd/helpers.ts
|
|
1636
|
-
/**
|
|
1637
|
-
* Resolve $imports for a schema by matching import schemaLocation to $filename.
|
|
1638
|
-
*
|
|
1639
|
-
* @param schema - The schema to resolve imports for
|
|
1640
|
-
* @param availableSchemas - Array of schemas that may be imported
|
|
1641
|
-
* @returns A new schema object with $imports populated
|
|
1642
|
-
*
|
|
1643
|
-
* @example
|
|
1644
|
-
* ```typescript
|
|
1645
|
-
* const orderSchema = parseXsd(orderXsd);
|
|
1646
|
-
* const commonSchema = { ...parseXsd(commonXsd), $filename: 'common.xsd' };
|
|
1647
|
-
*
|
|
1648
|
-
* // orderSchema has: import: [{ schemaLocation: 'common.xsd', ... }]
|
|
1649
|
-
* const resolved = resolveImports(orderSchema, [commonSchema]);
|
|
1650
|
-
* // resolved.$imports = [commonSchema]
|
|
1651
|
-
* ```
|
|
1652
|
-
*/
|
|
1653
|
-
function resolveImports(schema, availableSchemas) {
|
|
1654
|
-
const imports = [];
|
|
1655
|
-
if (schema.import) {
|
|
1656
|
-
for (const imp of schema.import) if (imp.schemaLocation) {
|
|
1657
|
-
const found = availableSchemas.find((s) => s.$filename === imp.schemaLocation);
|
|
1658
|
-
if (found) imports.push(found);
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
return {
|
|
1662
|
-
...schema,
|
|
1663
|
-
$imports: imports
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
/**
|
|
1667
|
-
* Resolve $imports for multiple schemas, linking them together.
|
|
1668
|
-
*
|
|
1669
|
-
* @param schemas - Array of schemas to link together
|
|
1670
|
-
* @returns Array of schemas with $imports populated
|
|
1671
|
-
*
|
|
1672
|
-
* @example
|
|
1673
|
-
* ```typescript
|
|
1674
|
-
* const schemas = [
|
|
1675
|
-
* { ...parseXsd(orderXsd), $filename: 'order.xsd' },
|
|
1676
|
-
* { ...parseXsd(commonXsd), $filename: 'common.xsd' },
|
|
1677
|
-
* ];
|
|
1678
|
-
* const linked = linkSchemas(schemas);
|
|
1679
|
-
* // Each schema now has $imports resolved
|
|
1680
|
-
* ```
|
|
1681
|
-
*/
|
|
1682
|
-
function linkSchemas(schemas) {
|
|
1683
|
-
return schemas.map((schema) => resolveImports(schema, schemas));
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
854
|
//#endregion
|
|
1687
855
|
//#region src/xsd/traverser.ts
|
|
1688
856
|
/**
|
|
@@ -1995,20 +1163,28 @@ function expandComplexTypeExtension(ct, allTypes, visited = /* @__PURE__ */ new
|
|
|
1995
1163
|
if (visited.has(ct.name)) return ct;
|
|
1996
1164
|
visited.add(ct.name);
|
|
1997
1165
|
const mergedElements = [];
|
|
1166
|
+
const mergedAnys = [];
|
|
1998
1167
|
const mergedAttributes = [];
|
|
1999
1168
|
const baseName = stripNsPrefix(extension.base);
|
|
2000
1169
|
const baseType = allTypes.get(baseName);
|
|
2001
1170
|
if (baseType && !visited.has(baseName)) {
|
|
2002
1171
|
const expandedBase = expandComplexTypeExtension(baseType, allTypes, visited);
|
|
2003
1172
|
collectElementsFromType(expandedBase, mergedElements);
|
|
1173
|
+
collectAnysFromType(expandedBase, mergedAnys);
|
|
2004
1174
|
if (expandedBase.attribute) mergedAttributes.push(...expandedBase.attribute);
|
|
2005
1175
|
}
|
|
2006
1176
|
collectElementsFromGroup(extension.sequence, mergedElements);
|
|
2007
1177
|
collectElementsFromGroup(extension.choice, mergedElements);
|
|
2008
1178
|
collectElementsFromGroup(extension.all, mergedElements);
|
|
1179
|
+
collectAnysFromGroup(extension.sequence, mergedAnys);
|
|
1180
|
+
collectAnysFromGroup(extension.choice, mergedAnys);
|
|
1181
|
+
collectAnysFromGroup(extension.all, mergedAnys);
|
|
2009
1182
|
if (extension.attribute) mergedAttributes.push(...extension.attribute);
|
|
2010
1183
|
const flattened = { name: ct.name };
|
|
2011
|
-
if (mergedElements.length > 0) flattened.all = {
|
|
1184
|
+
if (mergedElements.length > 0 || mergedAnys.length > 0) flattened.all = {
|
|
1185
|
+
...mergedElements.length > 0 ? { element: mergedElements } : {},
|
|
1186
|
+
...mergedAnys.length > 0 ? { any: mergedAnys } : {}
|
|
1187
|
+
};
|
|
2012
1188
|
if (mergedAttributes.length > 0) flattened.attribute = mergedAttributes;
|
|
2013
1189
|
for (const [key, value] of Object.entries(ct)) if (![
|
|
2014
1190
|
"name",
|
|
@@ -2029,6 +1205,14 @@ function collectElementsFromType(ct, elements) {
|
|
|
2029
1205
|
collectElementsFromGroup(ct.all, elements);
|
|
2030
1206
|
}
|
|
2031
1207
|
/**
|
|
1208
|
+
* Collect xs:any wildcards from a complex type's content model.
|
|
1209
|
+
*/
|
|
1210
|
+
function collectAnysFromType(ct, anys) {
|
|
1211
|
+
collectAnysFromGroup(ct.sequence, anys);
|
|
1212
|
+
collectAnysFromGroup(ct.choice, anys);
|
|
1213
|
+
collectAnysFromGroup(ct.all, anys);
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
2032
1216
|
* Collect elements from a group (sequence/choice/all).
|
|
2033
1217
|
*/
|
|
2034
1218
|
function collectElementsFromGroup(group, elements) {
|
|
@@ -2036,6 +1220,16 @@ function collectElementsFromGroup(group, elements) {
|
|
|
2036
1220
|
elements.push(...group.element);
|
|
2037
1221
|
}
|
|
2038
1222
|
/**
|
|
1223
|
+
* Collect xs:any wildcards from a group (sequence/choice/all),
|
|
1224
|
+
* descending into nested groups.
|
|
1225
|
+
*/
|
|
1226
|
+
function collectAnysFromGroup(group, anys) {
|
|
1227
|
+
if (!group) return;
|
|
1228
|
+
if (group.any) anys.push(...group.any);
|
|
1229
|
+
for (const nested of group.sequence ?? []) collectAnysFromGroup(nested, anys);
|
|
1230
|
+
for (const nested of group.choice ?? []) collectAnysFromGroup(nested, anys);
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
2039
1233
|
* Expand substitution group references in a complex type.
|
|
2040
1234
|
* Replaces abstract element refs with concrete substitute elements.
|
|
2041
1235
|
*/
|
|
@@ -2257,7 +1451,8 @@ function linkSchema(schema, options) {
|
|
|
2257
1451
|
Object.assign(loadedSchema, { $filename: schemaLocation });
|
|
2258
1452
|
inProgress.add(fullPath);
|
|
2259
1453
|
cache.set(fullPath, loadedSchema);
|
|
2260
|
-
|
|
1454
|
+
const newBasePath = dirname(fullPath);
|
|
1455
|
+
linkSchemaInternal(loadedSchema, newBasePath);
|
|
2261
1456
|
inProgress.delete(fullPath);
|
|
2262
1457
|
return loadedSchema;
|
|
2263
1458
|
};
|
|
@@ -2435,8 +1630,9 @@ async function runCodegen(config, options) {
|
|
|
2435
1630
|
const xsdContent = readFileSync(xsdPath, "utf-8");
|
|
2436
1631
|
const schema = parseXsd(xsdContent);
|
|
2437
1632
|
schema.$filename = `${schemaName}.xsd`;
|
|
1633
|
+
const basePath = dirname(xsdPath);
|
|
2438
1634
|
linkSchema(schema, {
|
|
2439
|
-
basePath
|
|
1635
|
+
basePath,
|
|
2440
1636
|
throwOnMissing: false
|
|
2441
1637
|
});
|
|
2442
1638
|
const schemaInfo = {
|
|
@@ -2596,7 +1792,8 @@ function discoverDependentSchemas(entrySchemas, xsdDir, log) {
|
|
|
2596
1792
|
if (!existsSync(xsdPath)) throw new Error(`Schema not found: ${schemaName}.xsd (resolved: ${xsdPath})`);
|
|
2597
1793
|
discovered.add(schemaName);
|
|
2598
1794
|
try {
|
|
2599
|
-
const
|
|
1795
|
+
const xsdContent = readFileSync(xsdPath, "utf-8");
|
|
1796
|
+
const deps = extractSchemaLocations(parseXsd(xsdContent), xsdDir, schemaName);
|
|
2600
1797
|
for (const dep of deps) if (!discovered.has(dep)) {
|
|
2601
1798
|
queue.push(dep);
|
|
2602
1799
|
log(` 🔗 Discovered dependency: ${dep} (from ${schemaName})`);
|
|
@@ -2647,5 +1844,5 @@ function resolveSchemaName(schemaLocation, currentDir, xsdDir) {
|
|
|
2647
1844
|
}
|
|
2648
1845
|
|
|
2649
1846
|
//#endregion
|
|
2650
|
-
export {
|
|
2651
|
-
//# sourceMappingURL=runner-
|
|
1847
|
+
export { getLocalName as _, loadAndLinkSchema as a, getSubstitutes as c, SchemaTraverser as d, resolveSchemaTypes as f, getChildElements as g, getAttributeValue as h, linkSchema as i, resolveSchema as l, getAllChildElements as m, createSchemaLoader as n, loadSchema as o, parseXsd as p, defaultLoader as r, parseSchemaContent as s, runCodegen as t, SchemaResolver as u, getTextContent as v };
|
|
1848
|
+
//# sourceMappingURL=runner-DX40fZp_.mjs.map
|