Skip to content

Commit 1b4997b

Browse files
authored
Adding flatfile.reader and format - thus completing the new 'fixed-length2' format handler with nested structure support. (#170)
Next steps: - enable it from omnniv21 schema handler - add samples - add more end to end integration tests - update cli server sample collection - documentation on 'fixed-length2', deprecation of 'fixed-length' and migration strategy.
1 parent fa74a27 commit 1b4997b

9 files changed

+1530
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"Children": [
3+
{
4+
"Children": [
5+
{
6+
"Children": null,
7+
"Data": "world",
8+
"FirstChild": null,
9+
"FormatSpecific": null,
10+
"LastChild": null,
11+
"NextSibling": null,
12+
"Parent": "(ElementNode W)",
13+
"PrevSibling": null,
14+
"Type": "TextNode"
15+
}
16+
],
17+
"Data": "W",
18+
"FirstChild": "(TextNode 'world')",
19+
"FormatSpecific": null,
20+
"LastChild": "(TextNode 'world')",
21+
"NextSibling": "(ElementNode C)",
22+
"Parent": "(ElementNode test-envelope)",
23+
"PrevSibling": null,
24+
"Type": "ElementNode"
25+
},
26+
{
27+
"Children": [
28+
{
29+
"Children": null,
30+
"Data": "c",
31+
"FirstChild": null,
32+
"FormatSpecific": null,
33+
"LastChild": null,
34+
"NextSibling": null,
35+
"Parent": "(ElementNode C)",
36+
"PrevSibling": null,
37+
"Type": "TextNode"
38+
}
39+
],
40+
"Data": "C",
41+
"FirstChild": "(TextNode 'c')",
42+
"FormatSpecific": null,
43+
"LastChild": "(TextNode 'c')",
44+
"NextSibling": null,
45+
"Parent": "(ElementNode test-envelope)",
46+
"PrevSibling": "(ElementNode W)",
47+
"Type": "ElementNode"
48+
}
49+
],
50+
"Data": "test-envelope",
51+
"FirstChild": "(ElementNode W)",
52+
"FormatSpecific": null,
53+
"LastChild": "(ElementNode C)",
54+
"NextSibling": null,
55+
"Parent": null,
56+
"PrevSibling": null,
57+
"Type": "ElementNode"
58+
}
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
{
2+
"Children": [
3+
{
4+
"Children": [
5+
{
6+
"Children": [
7+
{
8+
"Children": null,
9+
"Data": "2",
10+
"FirstChild": null,
11+
"FormatSpecific": null,
12+
"LastChild": null,
13+
"NextSibling": null,
14+
"Parent": "(ElementNode c2)",
15+
"PrevSibling": null,
16+
"Type": "TextNode"
17+
}
18+
],
19+
"Data": "c2",
20+
"FirstChild": "(TextNode '2')",
21+
"FormatSpecific": null,
22+
"LastChild": "(TextNode '2')",
23+
"NextSibling": null,
24+
"Parent": "(ElementNode e2)",
25+
"PrevSibling": null,
26+
"Type": "ElementNode"
27+
}
28+
],
29+
"Data": "e2",
30+
"FirstChild": "(ElementNode c2)",
31+
"FormatSpecific": null,
32+
"LastChild": "(ElementNode c2)",
33+
"NextSibling": "(ElementNode e3)",
34+
"Parent": "(ElementNode e1)",
35+
"PrevSibling": null,
36+
"Type": "ElementNode"
37+
},
38+
{
39+
"Children": [
40+
{
41+
"Children": [
42+
{
43+
"Children": null,
44+
"Data": "1",
45+
"FirstChild": null,
46+
"FormatSpecific": null,
47+
"LastChild": null,
48+
"NextSibling": null,
49+
"Parent": "(ElementNode c31)",
50+
"PrevSibling": null,
51+
"Type": "TextNode"
52+
}
53+
],
54+
"Data": "c31",
55+
"FirstChild": "(TextNode '1')",
56+
"FormatSpecific": null,
57+
"LastChild": "(TextNode '1')",
58+
"NextSibling": "(ElementNode c32)",
59+
"Parent": "(ElementNode e3)",
60+
"PrevSibling": null,
61+
"Type": "ElementNode"
62+
},
63+
{
64+
"Children": [
65+
{
66+
"Children": null,
67+
"Data": "2",
68+
"FirstChild": null,
69+
"FormatSpecific": null,
70+
"LastChild": null,
71+
"NextSibling": null,
72+
"Parent": "(ElementNode c32)",
73+
"PrevSibling": null,
74+
"Type": "TextNode"
75+
}
76+
],
77+
"Data": "c32",
78+
"FirstChild": "(TextNode '2')",
79+
"FormatSpecific": null,
80+
"LastChild": "(TextNode '2')",
81+
"NextSibling": null,
82+
"Parent": "(ElementNode e3)",
83+
"PrevSibling": "(ElementNode c31)",
84+
"Type": "ElementNode"
85+
}
86+
],
87+
"Data": "e3",
88+
"FirstChild": "(ElementNode c31)",
89+
"FormatSpecific": null,
90+
"LastChild": "(ElementNode c32)",
91+
"NextSibling": "(ElementNode e3)",
92+
"Parent": "(ElementNode e1)",
93+
"PrevSibling": "(ElementNode e2)",
94+
"Type": "ElementNode"
95+
},
96+
{
97+
"Children": [
98+
{
99+
"Children": [
100+
{
101+
"Children": null,
102+
"Data": "3",
103+
"FirstChild": null,
104+
"FormatSpecific": null,
105+
"LastChild": null,
106+
"NextSibling": null,
107+
"Parent": "(ElementNode c31)",
108+
"PrevSibling": null,
109+
"Type": "TextNode"
110+
}
111+
],
112+
"Data": "c31",
113+
"FirstChild": "(TextNode '3')",
114+
"FormatSpecific": null,
115+
"LastChild": "(TextNode '3')",
116+
"NextSibling": "(ElementNode c32)",
117+
"Parent": "(ElementNode e3)",
118+
"PrevSibling": null,
119+
"Type": "ElementNode"
120+
},
121+
{
122+
"Children": [
123+
{
124+
"Children": null,
125+
"Data": "4",
126+
"FirstChild": null,
127+
"FormatSpecific": null,
128+
"LastChild": null,
129+
"NextSibling": null,
130+
"Parent": "(ElementNode c32)",
131+
"PrevSibling": null,
132+
"Type": "TextNode"
133+
}
134+
],
135+
"Data": "c32",
136+
"FirstChild": "(TextNode '4')",
137+
"FormatSpecific": null,
138+
"LastChild": "(TextNode '4')",
139+
"NextSibling": null,
140+
"Parent": "(ElementNode e3)",
141+
"PrevSibling": "(ElementNode c31)",
142+
"Type": "ElementNode"
143+
}
144+
],
145+
"Data": "e3",
146+
"FirstChild": "(ElementNode c31)",
147+
"FormatSpecific": null,
148+
"LastChild": "(ElementNode c32)",
149+
"NextSibling": "(ElementNode e4)",
150+
"Parent": "(ElementNode e1)",
151+
"PrevSibling": "(ElementNode e3)",
152+
"Type": "ElementNode"
153+
},
154+
{
155+
"Children": [
156+
{
157+
"Children": [
158+
{
159+
"Children": null,
160+
"Data": "4",
161+
"FirstChild": null,
162+
"FormatSpecific": null,
163+
"LastChild": null,
164+
"NextSibling": null,
165+
"Parent": "(ElementNode c4)",
166+
"PrevSibling": null,
167+
"Type": "TextNode"
168+
}
169+
],
170+
"Data": "c4",
171+
"FirstChild": "(TextNode '4')",
172+
"FormatSpecific": null,
173+
"LastChild": "(TextNode '4')",
174+
"NextSibling": null,
175+
"Parent": "(ElementNode e4)",
176+
"PrevSibling": null,
177+
"Type": "ElementNode"
178+
}
179+
],
180+
"Data": "e4",
181+
"FirstChild": "(ElementNode c4)",
182+
"FormatSpecific": null,
183+
"LastChild": "(ElementNode c4)",
184+
"NextSibling": null,
185+
"Parent": "(ElementNode e1)",
186+
"PrevSibling": "(ElementNode e3)",
187+
"Type": "ElementNode"
188+
}
189+
],
190+
"Data": "e1",
191+
"FirstChild": "(ElementNode e2)",
192+
"FormatSpecific": null,
193+
"LastChild": "(ElementNode e4)",
194+
"NextSibling": null,
195+
"Parent": "(DocumentNode)",
196+
"PrevSibling": null,
197+
"Type": "ElementNode"
198+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"Children": [
3+
{
4+
"Children": [
5+
{
6+
"Children": null,
7+
"Data": "1",
8+
"FirstChild": null,
9+
"FormatSpecific": null,
10+
"LastChild": null,
11+
"NextSibling": null,
12+
"Parent": "(ElementNode C)",
13+
"PrevSibling": null,
14+
"Type": "TextNode"
15+
}
16+
],
17+
"Data": "C",
18+
"FirstChild": "(TextNode '1')",
19+
"FormatSpecific": null,
20+
"LastChild": "(TextNode '1')",
21+
"NextSibling": null,
22+
"Parent": "(ElementNode E)",
23+
"PrevSibling": null,
24+
"Type": "ElementNode"
25+
}
26+
],
27+
"Data": "E",
28+
"FirstChild": "(ElementNode C)",
29+
"FormatSpecific": null,
30+
"LastChild": "(ElementNode C)",
31+
"NextSibling": null,
32+
"Parent": null,
33+
"PrevSibling": null,
34+
"Type": "ElementNode"
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"Children": [
3+
{
4+
"Children": [
5+
{
6+
"Children": null,
7+
"Data": "1",
8+
"FirstChild": null,
9+
"FormatSpecific": null,
10+
"LastChild": null,
11+
"NextSibling": null,
12+
"Parent": "(ElementNode C1)",
13+
"PrevSibling": null,
14+
"Type": "TextNode"
15+
}
16+
],
17+
"Data": "C1",
18+
"FirstChild": "(TextNode '1')",
19+
"FormatSpecific": null,
20+
"LastChild": "(TextNode '1')",
21+
"NextSibling": "(ElementNode C2)",
22+
"Parent": "(ElementNode E)",
23+
"PrevSibling": null,
24+
"Type": "ElementNode"
25+
},
26+
{
27+
"Children": [
28+
{
29+
"Children": null,
30+
"Data": "2",
31+
"FirstChild": null,
32+
"FormatSpecific": null,
33+
"LastChild": null,
34+
"NextSibling": null,
35+
"Parent": "(ElementNode C2)",
36+
"PrevSibling": null,
37+
"Type": "TextNode"
38+
}
39+
],
40+
"Data": "C2",
41+
"FirstChild": "(TextNode '2')",
42+
"FormatSpecific": null,
43+
"LastChild": "(TextNode '2')",
44+
"NextSibling": null,
45+
"Parent": "(ElementNode E)",
46+
"PrevSibling": "(ElementNode C1)",
47+
"Type": "ElementNode"
48+
}
49+
],
50+
"Data": "E",
51+
"FirstChild": "(ElementNode C1)",
52+
"FormatSpecific": null,
53+
"LastChild": "(ElementNode C2)",
54+
"NextSibling": null,
55+
"Parent": null,
56+
"PrevSibling": null,
57+
"Type": "ElementNode"
58+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"file_declaration": {
3+
"envelopes": [
4+
{
5+
"name": "e1",
6+
"type": "envelope_group",
7+
"is_target": true,
8+
"min": 1,
9+
"max": 1,
10+
"child_envelopes": [
11+
{
12+
"name": "e2",
13+
"max": 5,
14+
"columns": [
15+
{
16+
"name": "c1",
17+
"start_pos": 1,
18+
"length": 3
19+
}
20+
]
21+
},
22+
{
23+
"name": "e2",
24+
"header": "^ABC$",
25+
"columns": [
26+
{
27+
"name": "c2",
28+
"start_pos": 2,
29+
"length": 5,
30+
"line_pattern": "^H00"
31+
}
32+
]
33+
}
34+
]
35+
}
36+
]
37+
},
38+
"XPath": ".[c1 != 'skip']"
39+
}

0 commit comments

Comments
 (0)