how to use the BizTalk Flat File Mapping Wizard for nested repeating items?
I have a flat file with some repeating sections in it, and I'm confused how to create the schema via the BT flat file mapping wizard. The file looks like this:
001,bunch of data
002,bunch of data
006,bunch of data
006A,bunch of data
006B,bunch of data
006B,bunch of data
006,bunch of data
006A,bunch of data
006B,bunch of data
As you can see, the 006* records can repeat. I'm going to want to wind up with XML that looks like this:
<001Stuff>...</001Stuff>
<002Stuff>...</002Stuff>
<006Loop>
<006Stuff>...</006Stuff>
<006AStuff>...</006AStuff>
<006BStuff>开发者_开发知识库;...</006BStuff>
<006BStuff>...</006BStuff>
</006Loop>
<006Loop>
<006Stuff>...</006Stuff>
<006AStuff>...</006AStuff>
<006BStuff>...</006BStuff>
</006Loop>
Obviously I can't just set the first group of 006* records to "Repeating record" and Ignore the second set. I'm used to dealing with single repeating rows via the wizard (i.e. another 006 row right after the first one) and not nested things like this - any suggestions on how to proceed? Thanks!
Working with the Flat File Schema Wizard is quite hard and there is only so much it can help you with. I always seem to have to tweak its output a little bit.
In order to make things a little bit easier, I suggest you should restrict your sample document to a single occurrence of the whole <006>
structure. You will not have to set many lines to Ignored
using the Flat File Schema Wizard :
001,bunch of data
002,bunch of data
006,bunch of data
006A,bunch of data
006B,bunch of data
006B,bunch of data
Next, each repeating structure should be wrapped inside a corresponding Repeating Record in the definition of your Xml Schema.
Please, note that you can always run the Flat File Schema Wizard recursively on nested structures to have more fine-grained control. So I would suggest, first, to run the wizard with an all-encompassing repeating <006>
structure, like so :
Then, you can right click on the structure, and provide a more detailed definition of nested child structures, only highlighting a subset of the sample contents, like so:
Then, the most important part: you need to tweak the Child Order
property to Conditional Default
for both repeating structures, because there is only one empty line at the end of your document file and the Wizard cannot help you out with this situation.
For reference, your resulting structure should look like so:
With the following settings:
BunchOfStuff (Root)
: Delimited,0x0D 0x0A
, Suffix._001Stuff
: Delimited,,
, Prefix, Tag Identifier001
._002Stuff
: Delimited,,
, Prefix, Tag Identifier002
._006Loop
: Delimited,0x0D 0x0A
, Conditional Default._006Stuff
: Delimited,,
, Prefix, Tag Identifier006
._006AStuff
: Delimited,,
, Prefix, Tag Identifier006A
._006BLoop
: Delimited,0x0D 0x0A
, Conditional Default._006BStuff
: Delimited,,
, Prefix, Tag Identifier006B
.
Hope this helps.
Treat everything from the first start of the first 006, record to the start of the second 006, record as one record. When you define 006 record, set it up as a repeating record also. This should create a node for each 660, group and nodes for each 600 under it.
That is what I would try.
Here is my output after 2 minutes of work. Except for the node/element names I think it is what you want. You would still have to create seperate elements for each of the fields in your data.
<_x0030_01 xmlns="">001,bunch of data <_x0030_02 xmlns="">002,bunch of data <_x0030_06 xmlns=""> <_x0030_06_Child1>bunch of data <_x0030_06_Child2> <_x0030_06_Child2_Child1>A,bunch of data <_x0030_06_Child2> <_x0030_06_Child2_Child1>B,bunch of data <_x0030_06_Child2> <_x0030_06_Child2_Child1>B,bunch of data <_x0030_06 xmlns=""> <_x0030_06_Child1>bunch of data <_x0030_06_Child2> <_x0030_06_Child2_Child1>A,bunch of data <_x0030_06_Child2> <_x0030_06_Child2_Child1>B,bunch of data
精彩评论