-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapter12.html
More file actions
1857 lines (1777 loc) · 139 KB
/
Copy pathChapter12.html
File metadata and controls
1857 lines (1777 loc) · 139 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chapter 12 — FundsXML in the System Landscape</title>
<link rel="icon" type="image/png" href="FundsXML-Logo.png">
<style>
:root {
--ink: #1a1a1a;
--ink-soft: #444;
--ink-muted: #6b7280;
--accent: #0b5394;
--accent-soft: #e3ecf6;
--accent-hover: #083d73;
--rule: #d0d7de;
--rule-soft: #e8ecf1;
--bg: #fbfbf8;
--paper: #ffffff;
--callout: #f3f6fb;
--row-alt: #f6f8fa;
--code-bg: #f4f6f9;
--code-ink: #22272e;
--tok-tag: #0b5394;
--tok-attr: #1a7f4b;
--tok-string: #a8410a;
--tok-comment: #6b7280;
--tok-decl: #7048c4;
--tok-punct: #6b7684;
--tip: #1a7f4b;
--tip-bg: #effaf3;
--warn: #a85a00;
--warn-bg: #fff5e6;
--example: #5b4ab3;
--example-bg: #f1eefb;
--shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
--shadow-md: 0 2px 8px rgba(15,23,42,0.08);
}
html[data-theme="dark"] {
--ink: #e6e8eb;
--ink-soft: #b1b6bd;
--ink-muted: #858a93;
--accent: #79b8ff;
--accent-soft: #17304b;
--accent-hover: #a8d0ff;
--rule: #2e333b;
--rule-soft: #24282f;
--bg: #101214;
--paper: #191c1f;
--callout: #1b2432;
--row-alt: #171a1e;
--code-bg: #161a1f;
--code-ink: #d9dde3;
--tok-tag: #7cb7f5;
--tok-attr: #7fd0a3;
--tok-string: #e0966a;
--tok-comment: #8a919c;
--tok-decl: #c3aef2;
--tok-punct: #9aa2ad;
--tip: #6bd494;
--tip-bg: #122820;
--warn: #e7a76b;
--warn-bg: #2b1f12;
--example: #b4a6f4;
--example-bg: #231d37;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
--shadow-md: 0 2px 10px rgba(0,0,0,0.45);
}
html[data-theme="dark"] img { filter: brightness(0.92) contrast(1.05); }
html {
-webkit-text-size-adjust: 100%;
scroll-behavior: smooth;
}
body {
font-family: "Source Serif Pro", "Source Serif 4", Georgia, "Times New Roman", serif;
font-size: 18px;
line-height: 1.65;
color: var(--ink);
background: var(--bg);
max-width: 46em;
margin: 3em auto;
padding: 0 1.5em;
hyphens: auto;
hyphenate-limit-chars: 7 3 3;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
font-feature-settings: "kern", "liga", "calt";
}
::selection { background: var(--accent-soft); color: var(--ink); }
h1, h2, h3, h4 {
font-family: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
color: var(--ink);
line-height: 1.25;
margin-top: 2em;
scroll-margin-top: 1.5em;
font-feature-settings: "kern", "liga";
letter-spacing: -0.005em;
}
h1 {
font-size: 2.1em;
border-bottom: 3px solid var(--accent);
padding-bottom: 0.3em;
margin-top: 0;
letter-spacing: -0.015em;
}
h1 .subtitle {
display: block;
font-size: 0.55em;
font-weight: 400;
font-style: italic;
color: var(--ink-soft);
margin-top: 0.4em;
letter-spacing: 0;
}
h2 {
font-size: 1.45em;
margin-top: 2.4em;
border-bottom: 1px solid var(--rule);
padding-bottom: 0.2em;
}
h3 { font-size: 1.15em; color: var(--accent); }
h4 { font-size: 1em; color: var(--ink-soft); }
p {
margin: 0.9em 0;
text-align: justify;
text-justify: inter-word;
orphans: 2;
widows: 2;
}
ul, ol { padding-left: 1.4em; }
li { margin: 0.35em 0; }
li::marker { color: var(--accent); }
strong { color: var(--ink); font-weight: 600; }
em { color: var(--ink-soft); }
hr {
border: none;
border-top: 1px solid var(--rule);
margin: 2.4em 0;
}
a {
color: var(--accent);
text-decoration: underline;
text-decoration-thickness: 1px;
text-decoration-color: rgba(11, 83, 148, 0.35);
text-underline-offset: 0.18em;
transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover {
color: var(--accent-hover);
text-decoration-color: var(--accent);
}
a:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
border-radius: 2px;
}
html[data-theme="dark"] a { text-decoration-color: rgba(121, 184, 255, 0.4); }
table {
border-collapse: collapse;
width: 100%;
margin: 1.8em 0;
font-size: 0.92em;
font-family: "Inter", -apple-system, sans-serif;
font-variant-numeric: tabular-nums lining-nums;
background: var(--paper);
border-radius: 4px;
overflow: hidden;
box-shadow: var(--shadow-sm);
}
caption {
caption-side: bottom;
text-align: left;
color: var(--ink-soft);
font-family: "Inter", sans-serif;
font-size: 0.9em;
font-style: italic;
padding: 0.6em 0.2em 0;
}
th, td {
text-align: left;
padding: 0.6em 0.85em;
border-bottom: 1px solid var(--rule-soft);
vertical-align: top;
}
th {
background: var(--callout);
border-bottom: 2px solid var(--accent);
font-weight: 600;
color: var(--ink);
}
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: none; }
blockquote {
margin: 1.4em 0;
padding: 1em 1.2em;
background: var(--callout);
border-left: 4px solid var(--accent);
color: var(--ink-soft);
font-size: 0.95em;
border-radius: 0 4px 4px 0;
}
blockquote p { margin: 0.4em 0; }
blockquote p:first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }
blockquote.tip { background: var(--tip-bg); border-color: var(--tip); }
blockquote.warning { background: var(--warn-bg); border-color: var(--warn); color: var(--ink); }
blockquote.example { background: var(--example-bg); border-color: var(--example); }
code {
font-family: "JetBrains Mono", "Source Code Pro", "SF Mono", Menlo, Consolas, monospace;
font-size: 0.9em;
background: var(--code-bg);
color: var(--code-ink);
padding: 0.1em 0.35em;
border-radius: 3px;
font-feature-settings: "liga" 0, "calt" 0;
word-break: break-word;
}
pre {
font-family: "JetBrains Mono", "Source Code Pro", "SF Mono", Menlo, Consolas, monospace;
font-size: 0.85em;
line-height: 1.55;
background: var(--code-bg);
color: var(--code-ink);
border-left: 3px solid var(--accent);
padding: 1em 1.2em;
margin: 1.4em 0;
overflow-x: auto;
hyphens: none;
tab-size: 2;
border-radius: 0 4px 4px 0;
box-shadow: var(--shadow-sm);
font-feature-settings: "liga" 0, "calt" 0;
}
pre code {
background: none;
padding: 0;
border-radius: 0;
font-size: 1em;
word-break: normal;
}
pre .tok-tag { color: var(--tok-tag); }
pre .tok-attr { color: var(--tok-attr); }
pre .tok-string { color: var(--tok-string); }
pre .tok-comment { color: var(--tok-comment); font-style: italic; }
pre .tok-decl { color: var(--tok-decl); }
pre .tok-punct { color: var(--tok-punct); }
figure { margin: 1.6em 0; text-align: center; }
figure img { max-width: 100%; height: auto; border-radius: 4px; box-shadow: var(--shadow-sm); }
figcaption {
font-family: "Inter", sans-serif;
font-size: 0.88em;
color: var(--ink-soft);
margin-top: 0.6em;
font-style: italic;
}
img { max-width: 100%; height: auto; }
.chapter-meta {
font-family: "Inter", sans-serif;
font-size: 0.85em;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--accent);
font-weight: 600;
margin-bottom: 0.6em;
}
.lead { font-size: 1.08em; color: var(--ink-soft); font-style: italic; }
.glossary-entry { margin: 0.6em 0; }
.glossary-entry strong { color: var(--accent); }
.idx { line-height: 1.55; margin: 0.15em 0; }
.idx strong { color: var(--ink); }
.index-note { font-size: 0.9em; color: var(--ink-soft); margin-bottom: 1em; }
/* --- sticky chapter nav --- */
#toc-nav {
position: fixed;
top: 0;
left: 0;
width: 18em;
max-height: 100vh;
overflow-y: auto;
background: var(--bg);
border-right: 1px solid var(--rule);
padding: 1em 0.8em 1.5em 0.8em;
font-family: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
font-size: 0.72em;
line-height: 1.4;
z-index: 1000;
box-shadow: 2px 0 8px rgba(0,0,0,0.06);
transition: transform 0.25s ease;
scrollbar-width: thin;
scrollbar-color: var(--rule) transparent;
}
#toc-nav::-webkit-scrollbar { width: 6px; }
#toc-nav::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
#toc-nav::-webkit-scrollbar-track { background: transparent; }
#toc-nav.collapsed { transform: translateX(-100%); box-shadow: none; }
#toc-nav .toc-title {
font-weight: 700;
color: var(--accent);
margin-bottom: 0.8em;
padding-bottom: 0.4em;
font-size: 1.05em;
letter-spacing: 0.03em;
border-bottom: 1px solid var(--rule-soft);
}
#toc-nav ul { list-style: none; padding: 0; margin: 0; }
#toc-nav li { margin: 0.2em 0; }
#toc-nav li.toc-h1 {
font-weight: 700;
margin-top: 0.7em;
color: var(--accent);
}
#toc-nav a {
color: var(--ink-soft);
text-decoration: none;
display: block;
padding: 0.2em 0.5em;
border-radius: 3px;
border-left: 2px solid transparent;
transition: background 0.15s, color 0.15s, border-color 0.15s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#toc-nav a:hover { background: var(--callout); color: var(--accent); }
#toc-nav a.active {
background: var(--callout);
color: var(--accent);
border-left-color: var(--accent);
font-weight: 600;
}
#toc-toggle {
position: fixed;
top: 0.5em;
left: 0.5em;
z-index: 1001;
width: 2.1em;
height: 2.1em;
border: 1px solid var(--rule);
border-radius: 4px;
background: var(--bg);
color: var(--accent);
font-size: 1.1em;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--shadow-sm);
transition: left 0.25s ease, transform 0.15s;
font-family: "Inter", sans-serif;
}
#toc-toggle:hover { transform: scale(1.05); }
#toc-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#toc-toggle.open { left: 18.5em; }
/* --- heading anchor links --- */
.heading-anchor {
color: var(--rule);
text-decoration: none;
font-weight: 400;
margin-left: 0.35em;
opacity: 0;
transition: opacity 0.15s;
font-size: 0.72em;
vertical-align: middle;
}
h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor { opacity: 1; color: var(--accent); }
.heading-anchor:hover { color: var(--accent-hover); }
.heading-anchor:focus-visible {
opacity: 1;
outline: 2px solid var(--accent);
outline-offset: 2px;
border-radius: 2px;
}
/* --- back-to-top button --- */
#top-btn {
position: fixed;
bottom: 1.5em;
right: 1.5em;
padding: 0.6em 1em;
background: var(--accent);
color: #fff;
border: none;
border-radius: 999px;
font-family: "Inter", -apple-system, sans-serif;
font-size: 0.85em;
font-weight: 600;
letter-spacing: 0.03em;
cursor: pointer;
opacity: 0;
pointer-events: none;
transform: translateY(6px);
transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s;
box-shadow: var(--shadow-md);
z-index: 999;
}
#top-btn.visible { opacity: 0.95; pointer-events: auto; transform: translateY(0); }
#top-btn:hover { opacity: 1; background: var(--accent-hover); }
#top-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* --- per-chapter navigation bar (standalone pages only; stripped from
the concatenated complete book by build_complete.sh) --- */
.chapter-nav {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1em;
margin: 2.5em 0;
padding: 0.9em 0;
border-top: 1px solid var(--rule);
border-bottom: 1px solid var(--rule);
font-family: "Inter", -apple-system, sans-serif;
font-size: 0.85em;
font-weight: 600;
letter-spacing: 0.02em;
}
.chapter-nav:first-child { margin-top: 0; }
.chapter-nav a {
color: var(--accent);
text-decoration: none;
padding: 0.35em 0.2em;
transition: color 0.15s;
}
.chapter-nav a:hover { color: var(--accent-hover); }
.chapter-nav .cn-toc { color: var(--ink-muted); font-weight: 500; }
.chapter-nav .cn-disabled { color: var(--rule); cursor: default; }
.chapter-nav .cn-next { text-align: right; }
/* --- theme toggle --- */
#theme-btn {
position: fixed;
top: 0.5em;
right: 0.5em;
width: 2.1em;
height: 2.1em;
border-radius: 50%;
border: 1px solid var(--rule);
background: var(--paper);
color: var(--accent);
font-size: 1em;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--shadow-sm);
transition: transform 0.15s ease, background 0.15s, border-color 0.15s;
font-family: "Inter", -apple-system, sans-serif;
z-index: 1001;
}
#theme-btn:hover { transform: scale(1.05); border-color: var(--accent); }
#theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#theme-btn .icon-sun { display: none; }
#theme-btn .icon-moon { display: inline; }
html[data-theme="dark"] #theme-btn .icon-sun { display: inline; }
html[data-theme="dark"] #theme-btn .icon-moon { display: none; }
/* --- feedback (report an issue) --- */
#feedback-btn {
position: fixed;
top: 3.1em;
right: 0.5em;
width: 2.1em;
height: 2.1em;
border-radius: 50%;
border: 1px solid var(--rule);
background: var(--paper);
color: var(--accent);
font-size: 1em;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--shadow-sm);
transition: transform 0.15s ease, background 0.15s, border-color 0.15s;
font-family: "Inter", -apple-system, sans-serif;
z-index: 1001;
}
#feedback-btn:hover { transform: scale(1.05); border-color: var(--accent); }
#feedback-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#feedback-pop {
position: absolute;
display: none;
z-index: 1002;
}
#feedback-pop button {
padding: 0.45em 0.9em;
background: var(--accent);
color: #fff;
border: none;
border-radius: 999px;
font-family: "Inter", -apple-system, sans-serif;
font-size: 0.8em;
font-weight: 600;
letter-spacing: 0.02em;
cursor: pointer;
box-shadow: var(--shadow-md);
}
#feedback-pop button:hover { background: var(--accent-hover); }
/* --- download link (pill, visible only on screen) --- */
.download-link {
display: inline-block;
padding: 0.55em 1.1em;
background: var(--accent);
color: #fff;
text-decoration: none;
font-family: "Inter", -apple-system, sans-serif;
font-weight: 600;
font-size: 0.9em;
letter-spacing: 0.02em;
border-radius: 999px;
box-shadow: var(--shadow-sm);
transition: background 0.15s, transform 0.15s;
}
.download-link:hover {
background: var(--accent-hover);
color: #fff;
transform: translateY(-1px);
box-shadow: var(--shadow-md);
text-decoration: none;
}
.download-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.download-link::before {
content: "↓";
display: inline-block;
margin-right: 0.4em;
font-weight: 700;
}
/* --- medium viewports: push body right so the sidebar doesn't
overlap the first characters of each line --- */
@media (min-width: 901px) and (max-width: 1400px) {
body:has(#toc-nav:not(.collapsed)) {
padding-left: 18em;
}
}
/* --- small screens --- */
@media (max-width: 900px) {
body { margin: 2em auto; padding: 0 1em; }
#toc-nav { width: 82%; max-width: 20em; }
#toc-toggle.open { left: calc(82% + 0.5em); }
}
/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.001ms !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}
/* --- print --- */
@page { size: A4; margin: 22mm 18mm 20mm 18mm; }
@page :first { margin-top: 0; }
@media print {
html[data-theme="dark"] { /* force light theme in PDF regardless of user toggle */
--ink: #000; --ink-soft: #333; --ink-muted: #5a5f66;
--accent: #0b5394; --accent-soft: #e3ecf6; --accent-hover: #083d73;
--rule: #cfd4d9; --rule-soft: #e8ecf1;
--bg: #fff; --paper: #fff; --callout: #f5f7fb; --row-alt: #f7f9fc;
--code-bg: #f4f6f9; --code-ink: #22272e;
--tok-tag: #0b5394; --tok-attr: #1a7f4b; --tok-string: #a8410a;
--tok-comment: #6b7280; --tok-decl: #7048c4; --tok-punct: #6b7684;
}
:root {
--bg: #fff; --paper: #fff;
--ink: #000; --ink-soft: #333;
--rule: #cfd4d9; --callout: #f5f7fb; --row-alt: #f7f9fc;
}
#toc-nav, #toc-toggle, #top-btn, #theme-btn, #feedback-btn, #feedback-pop,
.chapter-nav, .heading-anchor, .download-link { display: none !important; }
body {
font-size: 10.5pt;
max-width: none;
margin: 0;
padding: 0;
line-height: 1.5;
background: #fff;
color: #000;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
h1 { font-size: 1.8em; }
h2 { font-size: 1.3em; page-break-after: avoid; }
h3, h4 { page-break-after: avoid; }
p, li { orphans: 3; widows: 3; }
table, blockquote, figure { page-break-inside: avoid; }
pre { page-break-inside: auto; white-space: pre-wrap; word-wrap: break-word; }
th, tbody tr:nth-child(even), .pages, h2.part-title {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
a { color: var(--accent); text-decoration: none; }
}
</style>
<script id="theme-preload">(function(){try{var t=localStorage.getItem('fundsxml-theme');if(t==='dark')document.documentElement.setAttribute('data-theme','dark');}catch(e){}})();</script>
</head>
<body>
<nav class="chapter-nav" aria-label="Chapter navigation"><a class="cn-prev" href="Chapter11.html">‹ Chapter 11</a><a class="cn-toc" href="index.html">Contents</a><a class="cn-next" href="Chapter13.html">Chapter 13 ›</a></nav>
<img src="FundsXML-Logo.png" alt="FundsXML" style="height:28px;width:auto;display:block;margin:0 0 1.5em 0;">
<h1>FundsXML in the System Landscape<span class="subtitle">Integration into existing IT architectures</span></h1>
<hr>
<h2>12.1 Setting the Scene: From File to System</h2>
<p>Chapters 10 and 11 treated FundsXML as a file on disk — a thing you validate, open in an editor, transform with XSLT. Real production systems rarely treat it that way. In a production architecture, a FundsXML file is the output of a pipeline that read from a database, assembled content from several source systems, and will shortly be emitted over an SFTP or HTTPS channel to a distributor. Or it is the input of a pipeline that fetched the file from a drop-box, parsed it, decomposed it into table rows, and loaded those rows into a downstream warehouse. The file is a transport format; the architecture around it is the interesting part.</p>
<p>This chapter is about that architecture. It describes the typical system scenarios that asset managers and distributors deploy, compares the four programming languages that dominate FundsXML implementation work (Java, Python, C#, JavaScript), walks through the strategies for reading and processing XML at scale (DOM, SAX, StAX, XPath), treats database integration and data-warehousing patterns, and closes with the automation and scheduling patterns that turn a working pipeline into a production pipeline.</p>
<p>A disclosure on code execution in this chapter: three of the four language examples have been <strong>run in the environment where this chapter was written</strong>, against a minimal but schema-valid FundsXML sample file, and the output shown in the chapter is the real output of those runs. The Python example uses <code>lxml</code>; the Node.js example uses <code>fast-xml-parser</code>; the Java example uses JAXP with XPath. The fourth example, the C# listing using LINQ to XML, follows standard idiomatic practice but was <strong>not executed</strong> in this environment because the .NET runtime was not installed. Readers who want to verify the C# example should copy it into a .NET project and run it themselves; the listing is structurally complete and should run without modification.</p>
<p>By the end of this chapter, you should be able to:</p>
<ul>
<li>name the handful of architectural patterns that recur in FundsXML production deployments;</li>
<li>choose a programming language and XML library for a new FundsXML implementation based on the existing stack rather than on theoretical preferences;</li>
<li>write a minimal reader for a FundsXML file in any of Java, Python, C#, or JavaScript;</li>
<li>choose between DOM-based, streaming (SAX/StAX), and XPath-based reading strategies for different file sizes and access patterns;</li>
<li>decide whether to store FundsXML data in a relational database, a document database, or an XML-native database;</li>
<li>design an ETL pipeline that loads FundsXML deliveries into a data warehouse;</li>
<li>select an automation and scheduling approach that matches the delivery frequency and the reliability requirements of the pipeline.</li>
</ul>
<hr>
<h2>12.2 Typical Architecture Scenarios</h2>
<p>Before we look at any code, a map of the architecture patterns that recur in real FundsXML deployments. Most production systems resemble one of the following scenarios, or a composition of two or three of them.</p>
<h3>12.2.1 The Producer Pipeline</h3>
<p>The producer pipeline is the sender of FundsXML data. Its inputs are internal databases, spreadsheets, and upstream feeds; its output is a FundsXML file (or a stream of files) that is shipped to one or more consumers. A typical producer pipeline has the following components:</p>
<ul>
<li>An <strong>aggregation layer</strong> that queries internal databases and collects the fund reference data, the portfolio positions, the regulatory template inputs, and everything else the delivery needs to carry.</li>
<li>A <strong>FundsXML generator</strong> that takes the aggregated data and produces an XML document against the target schema version.</li>
<li>A <strong>validation layer</strong> that runs the Chapter-10 two-stage validation (XSD + Schematron) and either passes the file to emission or rejects it with a diagnostic.</li>
<li>An <strong>emission layer</strong> that ships the validated file to its destination over SFTP, HTTPS, or a message queue.</li>
<li>An <strong>audit log</strong> that records every delivery, its status, and any validation failures for later investigation.</li>
</ul>
<p>The Europa Growth Fund's monthly delivery goes through exactly this pipeline: the fund administrator's systems aggregate the portfolio data around 20:00 CET on the last business day of the month, the generator produces a FundsXML file around 21:30, the validator checks it around 21:35, and the emission layer hands it off to the delivery channels by 22:00 to the distribution countries' drop-boxes.</p>
<p><strong>Figure 12.1 — Producer pipeline</strong></p>
<pre><code> ┌───────────┐ ┌───────────┐ ┌───────────┐
│ Portfolio │ │ Reference │ │ Regulatory│
│ database │ │ database │ │ feeds │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
▼ ▼ ▼
┌──────────────────────────────────┐
│ Aggregation layer │
└─────────────────┬────────────────┘
│
▼
┌──────────────────────────────────┐
│ FundsXML generator │
└─────────────────┬────────────────┘
│
▼
┌──────────────────────────────────┐
│ Two-stage validator (Chapter 10)│
└─────────────────┬────────────────┘
│ PASS
▼
┌──────────────────────────────────┐
│ Emission (SFTP/HTTPS/MQ) │──▶ Distributor
└─────────────────┬────────────────┘
│
▼
Audit log / archive
</code></pre>
<h3>12.2.2 The Consumer Pipeline</h3>
<p>The consumer pipeline is the mirror image. Its inputs are FundsXML files arriving from upstream producers; its outputs are rows in a database, entries in a reporting warehouse, rendered fact sheets, or messages on a downstream bus. A typical consumer pipeline has:</p>
<ul>
<li>An <strong>ingestion layer</strong> that fetches incoming files from a drop-box, queue, or HTTPS endpoint and moves them into a staging area.</li>
<li>A <strong>validation layer</strong> that runs the same two-stage validation as the producer did. A consumer that trusts the producer's validation completely is a consumer that eventually gets hurt by a producer bug; running the validation on the consumer side is the standard defensive practice.</li>
<li>A <strong>parsing and decomposition layer</strong> that reads the FundsXML file and extracts the data the consumer's downstream systems care about. A distributor cares about fund identities, NAVs, and costs; a data warehouse cares about portfolio positions; a regulator cares about <a href="https://fundsxml.github.io/index.html?xpath=/FundsXML4/RegulatoryReportings" target="_blank">RegulatoryReportings</a> modules. Different consumers decompose differently.</li>
<li>A <strong>loading layer</strong> that writes the decomposed data into the downstream storage, handling idempotency (so that a re-delivered file does not produce duplicate rows), versioning (so that an AMEND delivery replaces the earlier values cleanly), and error recovery.</li>
<li>An <strong>audit log</strong> on the consumer side as well, recording every file received and the outcome of its processing.</li>
</ul>
<h3>12.2.3 The Distributor Dispatcher</h3>
<p>A variant of the consumer pipeline is the <strong>dispatcher</strong>: a consumer that receives many FundsXML files and routes each to a different downstream system based on its content. A large retail distributor might have separate systems for retail KID disclosure, for institutional reporting, for internal fund screening, for the trading desk, and so on; each of those systems needs a subset of the data in each FundsXML file. The dispatcher reads the <a href="https://fundsxml.github.io/index.html?xpath=/FundsXML4/ControlData" target="_blank"><code>ControlData</code></a>, <code>RegulatoryReportings</code> block, and fund identifiers, then routes the file (or a transformed projection of it) to the right subset of downstream systems. The Chapter-4 description of the dispatcher's first five tasks — recognise, authenticate, route, deduplicate, sequence — applies exactly here.</p>
<h3>12.2.4 The Data Warehouse Loader</h3>
<p>A different variant is the <strong>warehouse loader</strong>: a consumer that is not interested in the ongoing operational flow but in the historical record. Every FundsXML file received is shredded into relational rows and loaded into a data warehouse alongside years of accumulated history, so that analysts can query fund performance, portfolio composition changes, and regulatory disclosure trends over long periods. The warehouse loader optimises for <em>bulk insert</em> rather than for <em>real-time response</em>; it accepts a latency of hours between file receipt and queryability in exchange for being able to handle hundreds of files per day. §12.6 treats the ETL patterns these loaders use.</p>
<h3>12.2.5 The Mixed-Workflow Asset Manager</h3>
<p>A mid-sized asset manager typically runs <strong>all four scenarios at once</strong>: a producer pipeline for outgoing FundsXML deliveries to distributors; a consumer pipeline for incoming deliveries from fund administrators; a dispatcher for routing incoming regulatory reports to different internal groups; a warehouse loader for historical analytics. The pipelines share some infrastructure (the same validation library, the same schema files, the same audit logging system) but are structurally distinct. Keeping the responsibilities separate is the way mature teams manage complexity.</p>
<hr>
<h2>12.3 Programming Language Comparison</h2>
<p>The FundsXML ecosystem is language-agnostic in the sense that any language with a competent XML library can produce and consume FundsXML. In practice, four languages dominate: <strong>Java</strong>, <strong>Python</strong>, <strong>C#</strong>, and <strong>JavaScript</strong> (specifically Node.js, for server-side code). This section walks through each one with a minimal but complete working example: open a FundsXML file, extract the fund's LEI and its total NAV, and print them. Side by side, the four examples show how idiomatic reading looks in each language.</p>
<p>The task is deliberately simple. A production pipeline does much more — multi-file handling, error recovery, logging, validation, and so on — but the minimal task shows how the language and its XML library feel. Readers picking a language for a new project should run each example, mentally scale it up to production, and pick the one that fits their existing stack most comfortably.</p>
<h3>12.3.1 The Common Test File</h3>
<p>All four examples read the same FundsXML file — a minimal but schema-valid document containing one fund with a LEI, a name, a currency, and a total net asset value.</p>
<pre><code><span class="tok-decl"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="tok-punct"><</span><span class="tok-tag">FundsXML4</span> <span class="tok-attr">xmlns:xsi</span><span class="tok-punct">=</span><span class="tok-string">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span class="tok-attr">xsi:noNamespaceSchemaLocation</span><span class="tok-punct">=</span><span class="tok-string">"FundsXML4.xsd"</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">ControlData</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">UniqueDocumentID</span><span class="tok-punct">></span>EGF-20260331-LANG-001<span class="tok-punct"></</span><span class="tok-tag">UniqueDocumentID</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">DocumentGenerated</span><span class="tok-punct">></span>2026-04-01T06:47:13Z<span class="tok-punct"></</span><span class="tok-tag">DocumentGenerated</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Version</span><span class="tok-punct">></span>4.2.8<span class="tok-punct"></</span><span class="tok-tag">Version</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">ContentDate</span><span class="tok-punct">></span>2026-03-31<span class="tok-punct"></</span><span class="tok-tag">ContentDate</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">DataSupplier</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">SystemCountry</span><span class="tok-punct">></span>LU<span class="tok-punct"></</span><span class="tok-tag">SystemCountry</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Short</span><span class="tok-punct">></span>EAM<span class="tok-punct"></</span><span class="tok-tag">Short</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Name</span><span class="tok-punct">></span>Europa Asset Management S.A.<span class="tok-punct"></</span><span class="tok-tag">Name</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Type</span><span class="tok-punct">></span>IC<span class="tok-punct"></</span><span class="tok-tag">Type</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">DataSupplier</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">DataOperation</span><span class="tok-punct">></span>INITIAL<span class="tok-punct"></</span><span class="tok-tag">DataOperation</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Language</span><span class="tok-punct">></span>en<span class="tok-punct"></</span><span class="tok-tag">Language</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">ControlData</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Funds</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Fund</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Identifiers</span><span class="tok-punct">></span><span class="tok-punct"><</span><span class="tok-tag">LEI</span><span class="tok-punct">></span>549300ABCDEFGHIJ1234<span class="tok-punct"></</span><span class="tok-tag">LEI</span><span class="tok-punct">></span><span class="tok-punct"></</span><span class="tok-tag">Identifiers</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Names</span><span class="tok-punct">></span><span class="tok-punct"><</span><span class="tok-tag">OfficialName</span><span class="tok-punct">></span>Europa Growth Fund<span class="tok-punct"></</span><span class="tok-tag">OfficialName</span><span class="tok-punct">></span><span class="tok-punct"></</span><span class="tok-tag">Names</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Currency</span><span class="tok-punct">></span>EUR<span class="tok-punct"></</span><span class="tok-tag">Currency</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">SingleFundFlag</span><span class="tok-punct">></span>true<span class="tok-punct"></</span><span class="tok-tag">SingleFundFlag</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">FundDynamicData</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">TotalAssetValues</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">TotalAssetValue</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">NavDate</span><span class="tok-punct">></span>2026-03-31<span class="tok-punct"></</span><span class="tok-tag">NavDate</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">TotalAssetNature</span><span class="tok-punct">></span>OFFICIAL<span class="tok-punct"></</span><span class="tok-tag">TotalAssetNature</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">TotalNetAssetValue</span><span class="tok-punct">></span>
<span class="tok-punct"><</span><span class="tok-tag">Amount</span> <span class="tok-attr">ccy</span><span class="tok-punct">=</span><span class="tok-string">"EUR"</span><span class="tok-punct">></span>464552848.78<span class="tok-punct"></</span><span class="tok-tag">Amount</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">TotalNetAssetValue</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">TotalAssetValue</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">TotalAssetValues</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">FundDynamicData</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">Fund</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">Funds</span><span class="tok-punct">></span>
<span class="tok-punct"></</span><span class="tok-tag">FundsXML4</span><span class="tok-punct">></span>
</code></pre>
<p>This file validates against <code>FundsXML4.xsd</code> with the <code>xmllint</code> command from Chapter 10. The four language examples below all produce the same output:</p>
<pre><code>Europa Growth Fund
LEI: 549300ABCDEFGHIJ1234
NAV: 464552848.78 EUR
</code></pre>
<h3>12.3.2 Python with lxml</h3>
<p>Python's <code>lxml</code> library is the de facto standard for XML work in the Python ecosystem. It is built on top of libxml2 (the same C library that <code>xmllint</code> uses) and combines excellent performance with a Pythonic API. For FundsXML work, <code>lxml</code> offers DOM-style navigation through <code>ElementTree</code>, XPath queries, and schema validation all in one package.</p>
<pre><code>#!/usr/bin/env python3
"""Read a FundsXML file and print the fund LEI and total NAV."""
import sys
from lxml import etree
def read_fund(path: str) -> None:
doc = etree.parse(path)
fund = doc.find("./Funds/Fund")
if fund is None:
print(f"{path}: no Fund element found", file=sys.stderr)
sys.exit(1)
lei = fund.findtext("Identifiers/LEI") or "(no LEI)"
name = fund.findtext("Names/OfficialName") or "(unnamed)"
tav = fund.find(
"FundDynamicData/TotalAssetValues/TotalAssetValue/"
"TotalNetAssetValue/Amount"
)
if tav is None:
print(f"{name} ({lei}): no TotalNetAssetValue found")
return
amount = tav.text
currency = tav.get("ccy")
print(f"{name}")
print(f" LEI: {lei}")
print(f" NAV: {amount} {currency}")
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: read_fund.py <file.xml>", file=sys.stderr)
sys.exit(2)
read_fund(sys.argv[1])
</code></pre>
<p>Run with <code>python3 read_fund.py egf-sample.xml</code>. The API is compact, error handling is straightforward, and the code reads top-to-bottom without ceremony. For production use, <code>lxml</code> also offers:</p>
<ul>
<li><strong>Schema validation</strong> via <code>etree.XMLSchema</code> (equivalent to running <code>xmllint --schema</code>), integrated directly into the parsing step so that invalid documents fail on load.</li>
<li><strong>Schematron validation</strong> via <code>lxml.isoschematron</code> (which we used in Chapter 10).</li>
<li><strong>Incremental parsing</strong> via <code>etree.iterparse</code>, for files too large to load into memory.</li>
<li><strong>XPath 1.0</strong> queries via the <code>xpath()</code> method, for more complex extraction tasks.</li>
</ul>
<p>Python's strengths for FundsXML work are the speed of initial development, the range of adjacent libraries (pandas for data-frame manipulation, SQLAlchemy for database work, Airflow for orchestration), and the low cognitive overhead of small scripts. Its weaknesses are memory use on very large files (DOM-based parsing keeps the whole document in memory) and the GIL's limits on in-process parallelism.</p>
<h3>12.3.3 Java with JAXP and XPath</h3>
<p>Java is the most widely used language for FundsXML work on the producer side, primarily because it is the dominant language of enterprise asset-management systems. The JAXP API (Java API for XML Processing) ships with the JDK and provides both DOM and SAX parsing; <code>javax.xml.xpath.XPathFactory</code> provides XPath 1.0 queries against a parsed DOM.</p>
<pre><code>// ReadFund.java — Read a FundsXML file with JAXP + XPath and print LEI + NAV.
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
public class ReadFund {
public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("usage: java ReadFund <file.xml>");
System.exit(2);
}
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(false);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File(args[0]));
XPath xpath = XPathFactory.newInstance().newXPath();
Node fund = (Node) xpath.evaluate("/FundsXML4/Funds/Fund", doc,
javax.xml.xpath.XPathConstants.NODE);
if (fund == null) {
System.err.println(args[0] + ": no Fund element found");
System.exit(1);
}
String lei = xpath.evaluate("Identifiers/LEI", fund);
String name = xpath.evaluate("Names/OfficialName", fund);
Node amt = (Node) xpath.evaluate(
"FundDynamicData/TotalAssetValues/TotalAssetValue/"
+ "TotalNetAssetValue/Amount", fund,
javax.xml.xpath.XPathConstants.NODE);
if (amt == null) {
System.out.println(name + " (" + lei + "): no TotalNetAssetValue");
return;
}
String amount = amt.getTextContent();
String currency = amt.getAttributes().getNamedItem("ccy").getNodeValue();
System.out.println(name);
System.out.println(" LEI: " + lei);
System.out.println(" NAV: " + amount + " " + currency);
}
}
</code></pre>
<p>Compile and run with <code>javac ReadFund.java && java ReadFund egf-sample.xml</code>. The code is several times longer than the Python version and noticeably more ceremonious: the <code>DocumentBuilderFactory</code> / <code>DocumentBuilder</code> / <code>Document</code> triad, the explicit <code>(Node)</code> cast after each XPath evaluation, the uppercase qualified constant <code>javax.xml.xpath.XPathConstants.NODE</code>. Java's strength is not brevity; it is robustness, static type checking, and the maturity of its libraries.</p>
<p>Everything in the example above uses APIs that ship with the JDK itself — <code>javax.xml.parsers.*</code>, <code>javax.xml.xpath.*</code>, and the <code>org.w3c.dom.*</code> interfaces — so no third-party dependency is required. JAXP also covers two other styles of XML processing that are useful for different tasks, and both remain inside the JDK:</p>
<ul>
<li><strong>StAX</strong> (<code>javax.xml.stream.XMLStreamReader</code>) is the JDK's streaming parser, pulled rather than pushed. It is the right tool when the document is too large to hold in memory as a DOM — a multi-gigabyte TPT delivery covering hundreds of funds, for example — because StAX reads one event at a time and lets the application keep only the state it needs. The code is more involved than the DOM-plus-XPath style shown above, but the memory footprint is essentially constant.</li>
<li><strong>SAX</strong> (<code>org.xml.sax.*</code>) is the older event-driven parser, still present in the JDK for compatibility. Most new code that would have used SAX ten years ago now uses StAX instead.</li>
</ul>
<p>Schema validation is also built in: <code>javax.xml.validation.SchemaFactory</code> loads <code>FundsXML4.xsd</code> into a <code>Schema</code> object, which can then be attached to either the <code>DocumentBuilderFactory</code> (for validate-on-parse) or used directly through a <code>Validator</code> against a pre-parsed source. The approach is the exact JDK equivalent of the <code>xmllint --schema</code> invocations we used throughout Chapters 5–8.</p>
<p>Note that this section deliberately stays inside the JDK's own XML stack. Third-party Java libraries for XML exist — higher-level DOM alternatives such as DOM4J and JDOM, the Woodstox StAX implementation, and the Jakarta XML Binding (JAXB) framework that generates typed Java classes from an XSD — and some production Java projects do use them. The examples in this chapter stay with JAXP because it is zero-dependency, ships with every JDK, and is enough to read and write FundsXML documents in a robust and production-grade way.</p>
<p>Java's strengths for FundsXML are performance at scale, mature tooling (FreeXmlToolkit itself is built in Java), static type safety, and the enterprise-grade support stacks (Spring, Java EE) that most asset managers already run. Its weaknesses are verbosity and the startup cost of the JVM, which makes Java a poor choice for short ad-hoc scripts.</p>
<h3>12.3.4 C# with LINQ to XML</h3>
<p>C# and .NET dominate FundsXML work at insurance companies and at a subset of Microsoft-shop asset managers. The idiomatic XML API in modern C# is <strong>LINQ to XML</strong>, which provides a fluent query-style interface built on <code>XDocument</code>, <code>XElement</code>, and <code>XAttribute</code>. LINQ to XML is part of <code>System.Xml.Linq</code> in the base class library and does not require any additional package.</p>
<pre><code>// ReadFund.cs — Read a FundsXML file with LINQ to XML and print LEI + NAV.
// Build: dotnet run --project ReadFund.csproj <file.xml>
using System;
using System.Xml.Linq;
class ReadFund {
static int Main(string[] args) {
if (args.Length != 1) {
Console.Error.WriteLine("usage: ReadFund <file.xml>");
return 2;
}
var doc = XDocument.Load(args[0]);
var fund = doc.Root?.Element("Funds")?.Element("Fund");
if (fund == null) {
Console.Error.WriteLine($"{args[0]}: no Fund element found");
return 1;
}
string lei = (string?)fund.Element("Identifiers")?.Element("LEI") ?? "(no LEI)";
string name = (string?)fund.Element("Names")?.Element("OfficialName") ?? "(unnamed)";
var amount = fund
.Element("FundDynamicData")?
.Element("TotalAssetValues")?
.Element("TotalAssetValue")?
.Element("TotalNetAssetValue")?
.Element("Amount");
if (amount == null) {
Console.WriteLine($"{name} ({lei}): no TotalNetAssetValue found");
return 0;
}
string value = amount.Value;
string currency = (string?)amount.Attribute("ccy") ?? "";
Console.WriteLine(name);
Console.WriteLine($" LEI: {lei}");
Console.WriteLine($" NAV: {value} {currency}");
return 0;
}
}
</code></pre>
<p>The C# version sits stylistically between Python and Java: more concise than Java, slightly more ceremonious than Python. The <code>?.</code> null-conditional operator and the <code>(string?)</code> cast on <code>XElement</code> are the modern C# idioms for safe navigation through an XML tree. The fluent <code>.Element(...).Element(...).Element(...)</code> chain is the LINQ to XML signature.</p>
<p>(Note: this listing was not executed in the environment where this chapter was written, because the .NET runtime was not installed. The code is structurally complete and follows standard idiomatic practice; readers who want to verify it should install the .NET SDK and run <code>dotnet run</code> in a new project containing this file.)</p>
<p>For production C# work, additional options include:</p>
<ul>
<li><strong>XmlSerializer</strong> for class-based deserialisation (the C# equivalent of JAXB).</li>
<li><strong>XmlReader</strong> for streaming access to very large files.</li>
<li><strong>XPath</strong> via <code>XPathSelectElement</code> / <code>XPathSelectElements</code> extension methods, for XPath-based queries instead of the fluent <code>.Element(...)</code> chain.</li>
</ul>
<p>C#'s strengths are the tight integration with Microsoft-shop tools (SQL Server, Azure, SharePoint), strong static typing, and modern language ergonomics (records, pattern matching, nullable reference types). Its weaknesses are the cross-platform story (better than it used to be but still slightly less smooth than Java or Python) and the narrower open-source ecosystem around XML-specific tooling.</p>
<h3>12.3.5 JavaScript (Node.js) with fast-xml-parser</h3>
<p>Node.js dominates FundsXML work on the distributor side of the house, where many retail distribution platforms are built on JavaScript and TypeScript. XML is not a native JavaScript strength, but the <strong>fast-xml-parser</strong> npm package provides a competent pure-JavaScript parser that turns an XML document into a plain JavaScript object tree for navigation.</p>
<pre><code>// read_fund.mjs — Read a FundsXML file with fast-xml-parser and print LEI + NAV.
import { readFileSync } from "node:fs";
import { XMLParser } from "fast-xml-parser";
function readFund(path) {
const xml = readFileSync(path, "utf8");
const parser = new XMLParser({
ignoreAttributes: false,
attributeNamePrefix: "@_",
});
const doc = parser.parse(xml);
const fund = doc?.FundsXML4?.Funds?.Fund;
if (!fund) {
console.error(`${path}: no Fund element found`);
process.exit(1);
}
const lei = fund.Identifiers?.LEI ?? "(no LEI)";
const name = fund.Names?.OfficialName ?? "(unnamed)";
const tav =
fund.FundDynamicData?.TotalAssetValues?.TotalAssetValue
?.TotalNetAssetValue?.Amount;
if (!tav) {
console.log(`${name} (${lei}): no TotalNetAssetValue found`);
return;
}
const amount = typeof tav === "object" ? tav["#text"] : tav;
const currency = typeof tav === "object" ? tav["@_ccy"] : "";
console.log(name);
console.log(` LEI: ${lei}`);
console.log(` NAV: ${amount} ${currency}`);
}
const path = process.argv[2];
if (!path) {
console.error("usage: node read_fund.mjs <file.xml>");
process.exit(2);
}
readFund(path);
</code></pre>
<p>Install the parser with <code>npm install fast-xml-parser</code>, then run <code>node read_fund.mjs egf-sample.xml</code>. The JavaScript version is comparable in length to Python. The main idiomatic difference is that <code>fast-xml-parser</code> turns the XML into a plain JavaScript object, which means navigation is through normal object-property access (<code>doc.FundsXML4.Funds.Fund.Identifiers.LEI</code>) rather than through an XML-specific API. Attributes are surfaced as specially-named properties (<code>@_ccy</code>, following the parser's default convention) and elements with mixed content expose a <code>#text</code> property for the text value.</p>
<p>For production JavaScript work, alternatives include:</p>
<ul>
<li><strong>sax</strong> for SAX-style streaming access to large files.</li>
<li><strong>xml2js</strong> as a simpler alternative to fast-xml-parser, with a slightly slower but more configurable API.</li>
<li><strong>libxmljs2</strong> as a native-binding wrapper around libxml2 for developers who prefer a lower-level API and are willing to accept the native-binding complexity.</li>
<li>The browser-native <strong>DOMParser</strong> and <strong>XPath evaluator</strong> APIs, for client-side FundsXML work in a browser (rare, but occasionally useful for internal dashboards).</li>
</ul>
<p>JavaScript's strengths are the ubiquity of the runtime, the speed of development, and the natural fit with modern web-facing distributor architectures. Its weaknesses are XML-specific library maturity (JavaScript XML libraries are generally less mature than their Java, Python, or C# counterparts) and the lack of a native XSD validator in the standard libraries — for schema validation, a Node.js pipeline typically shells out to <code>xmllint</code> or uses a libxml2 binding.</p>
<h3>12.3.6 Side-by-Side Comparison</h3>
<p><strong>Table 12.1 — Programming language comparison for FundsXML</strong></p>
<table>
<thead>
<tr>
<th>Aspect</th>
<th>Java</th>
<th>Python</th>
<th>C#</th>
<th>JavaScript/Node</th>
</tr>
</thead>
<tbody>
<tr>
<td>Primary library</td>
<td>JAXP (JDK)</td>
<td>lxml</td>
<td>System.Xml.Linq</td>
<td>fast-xml-parser</td>
</tr>
<tr>
<td>Lines of minimal reader</td>
<td>~35</td>
<td>~25</td>
<td>~30</td>
<td>~30</td>
</tr>
<tr>
<td>Schema validation</td>
<td>Built-in (JAXP)</td>
<td>Built-in (lxml)</td>
<td>Built-in (XmlSchema)</td>
<td>External (xmllint)</td>
</tr>
<tr>
<td>Schematron</td>
<td>External (ph-schematron)</td>
<td>Built-in (lxml)</td>
<td>External (Saxon)</td>