|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
CSV DFDL with multiple 'Header' elements |
« View previous topic :: View next topic » |
Author |
Message
|
LiamDuffield |
Posted: Fri Jun 05, 2015 6:49 am Post subject: CSV DFDL with multiple 'Header' elements |
|
|
Newbie
Joined: 14 Mar 2014 Posts: 7
|
Hi Guys,
I'm trying to create a DFDL schema to accept multiple 'Header' elements and multiple 'Records', almost like multiple CSVs in a single file.
Example:
Code: |
HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
|
(Line breaks added to improve readability)
Annoyingly there are an unknown amount of Record elements per Header element.
I've tried creating a record DFDL, with unbounded Header element and defining the Header initiator as the static char but this produces a single header with the other Headers/Records entered as records.
I can loop around this in ESQL but want to be a bit more elegant and use DFDL to it's fullest.
Any nods towards any help would be much appreciated.[/code] |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jun 05, 2015 6:55 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to be able to discriminate between a header and a detail record.
You then need to put both of them into a repeating type, and have a single header followed by a repeating set of records. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Jun 05, 2015 12:02 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
mqjeff is spot-on.
Code: |
Message
RecordGroup maxOccurs="unbounded"
Header minOccurs=1 maxOccurs=1
Record maxOccurs="unbounded"
|
How will the DFDL parser know when a RecordGroup has f inished?
Answer : You have to design a discriminator for the Record element which returns false when it is trying to parse a Header. The DFDL parser will then back out of parsing the Record and try to parse another RecordGroup. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|