如何使用BizTalk平面文件映射向导来嵌套重复项? [英] how to use the BizTalk Flat File Mapping Wizard for nested repeating items?

查看:75
本文介绍了如何使用BizTalk平面文件映射向导来嵌套重复项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个平面文件,其中包含一些重复的部分,并且我对如何通过BT平面文件映射向导创建架构感到困惑.该文件如下所示:

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

如您所见,006 *记录可以重复.我要结束的XML看起来像这样:

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>

很显然,我不能仅将第一组006 *记录设置为重复记录",而忽略第二组.我习惯于通过向导处理单个重复的行(即在第一个重复的行之后再添加006行),而不是嵌套这样的内容-有关如何进行操作的任何建议?谢谢!

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.

为了使事情变得容易一些,我建议您将示例文档限制为仅出现整个<006>结构.您无需使用平面文件架构向导将许多行设置为Ignored:

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

接下来,应将每个重复结构包装在Xml模式定义中的相应重复记录内.

Next, each repeating structure should be wrapped inside a corresponding Repeating Record in the definition of your Xml Schema.

请注意,您始终可以在嵌套结构上递归运行平面文件架构向导"以具有更细粒度的控件.因此,我建议,首先,使用包含所有内容的重复<006>结构运行向导,如下所示:

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:

然后,最重要的部分:对于两个重复结构,您需要将Child Order属性调整为Conditional Default,因为在该处只有一个空行文档文件的末尾,向导将无法帮助您解决这种情况.

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:

具有以下设置:

  • BunchOfStuff (Root):定界符,0x0D 0x0A,后缀.
  • _001Stuff:定界符,,,前缀,标记标识符001.
  • _002Stuff:定界符,,,前缀,标记标识符002.
  • _006Loop:定界的,0x0D 0x0A有条件的默认值.
  • _006Stuff:定界符,,,前缀,标记标识符006.
  • _006AStuff:分隔符,,,前缀,标记标识符006A.
  • _006BLoop:定界的,0x0D 0x0A有条件的默认值.
  • _006BStuff:定界符,,,前缀,标记标识符006B.
  • BunchOfStuff (Root) : Delimited, 0x0D 0x0A, Suffix.
  • _001Stuff : Delimited, ,, Prefix, Tag Identifier 001.
  • _002Stuff : Delimited, ,, Prefix, Tag Identifier 002.
  • _006Loop : Delimited, 0x0D 0x0A, Conditional Default.
  • _006Stuff : Delimited, ,, Prefix, Tag Identifier 006.
  • _006AStuff : Delimited, ,, Prefix, Tag Identifier 006A.
  • _006BLoop : Delimited, 0x0D 0x0A, Conditional Default.
  • _006BStuff : Delimited, ,, Prefix, Tag Identifier 006B.

希望这会有所帮助.

这篇关于如何使用BizTalk平面文件映射向导来嵌套重复项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆