Biztalk 映射器更改节点顺序

发布于 2024-10-27 10:47:18 字数 1264 浏览 5 评论 0原文

我需要将文档 X 映射到文档 Y,两者非常相似。 X 具有以下 XSD [片段]:

<xsd:complexType>
   <xsd:sequence>
      <xsd:choice minOccurs="3" maxOccurs="unbounded">
             <xsd:element maxOccurs="unbounded" ref="A" /> 
             <xsd:element maxOccurs="unbounded" ref="B" /> 
             <xsd:element maxOccurs="unbounded" ref="C" /> 
             <xsd:element minOccurs="0" maxOccurs="unbounded" ref="D"/> 
      </xsd:choice>
   </xsd:sequence>
</xsd:complexType>

Y 具有相同的元素 (A、B、C),但它们不在序列内。

当我使用以下输入测试映射时,出现了我的问题:

<doc-X>
    <A>...</A>
    <B>...</B>            
    <C>...</C>
    <D>...</D>            
    <C>...</C>
    <D>...</D>            
</doc-X>    

我得到这样的结果:

<doc-Y>
    <A>...</A>
    <B>...</B>            
    <C>...</C>
    <C>...</C>            
    <D>...</D>
    <D>...</D>            
</doc-Y>

我不明白为什么会发生这种情况,因为我只是将每个元素与其对应的对映射到另一个模式上。

编辑:我尝试将属性PreserveSequenceOrder设置为“是”,但这没有用

I need to map document X to document Y, being both quite similar. X has the following [fragment of] XSD:

<xsd:complexType>
   <xsd:sequence>
      <xsd:choice minOccurs="3" maxOccurs="unbounded">
             <xsd:element maxOccurs="unbounded" ref="A" /> 
             <xsd:element maxOccurs="unbounded" ref="B" /> 
             <xsd:element maxOccurs="unbounded" ref="C" /> 
             <xsd:element minOccurs="0" maxOccurs="unbounded" ref="D"/> 
      </xsd:choice>
   </xsd:sequence>
</xsd:complexType>

Y has the same elements (A,B,C), but they're not within a sequence.

My problem arises when I test the map with the following input:

<doc-X>
    <A>...</A>
    <B>...</B>            
    <C>...</C>
    <D>...</D>            
    <C>...</C>
    <D>...</D>            
</doc-X>    

I get something like this:

<doc-Y>
    <A>...</A>
    <B>...</B>            
    <C>...</C>
    <C>...</C>            
    <D>...</D>
    <D>...</D>            
</doc-Y>

I don't understand why is this happening, since I just map each element with its corresponding pair on the other schema.

EDIT : I've tried putting the property PreserveSequenceOrder to "Yes", but that hasn't worked

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帝王念 2024-11-03 10:47:18

XSD 本身并不保证同级元素将以任何给定的顺序出现。根据您的描述,听起来输出根据其模式是完全有效的。你的测试图真的失败了吗?

有什么方法可以发布完整的架构和文档实例吗?

XSD on its own does not guarantee that sibling elements will appear in any given order. From what you've described, it sounds like the output is perfectly valid according to its schema. Are you actually getting a failure in your test map?

Is there any way you can post the complete schema and document instances?

谁对谁错谁最难过 2024-11-03 10:47:18

您之所以获得该输出,是因为 Map 始终查找从顶部元素到底部元素的输出文档(文档 Y)连接。因此,在您的情况下,它将执行第一个元素 A(在文档 Y 中)链接,然后执行 B,然后执行 C。

尝试将输出文档(文档 Y)xsd 修改为这样

    <xsd:complexType>
       <xsd:sequence>
          <xsd:choice minOccurs="3" maxOccurs="unbounded">
                 <xsd:element maxOccurs="unbounded" ref="D" /> 
                 <xsd:element maxOccurs="unbounded" ref="C" /> 
                 <xsd:element maxOccurs="unbounded" ref="B" /> 
                 <xsd:element minOccurs="0" maxOccurs="unbounded" ref="A"/> 
          </xsd:choice>
       </xsd:sequence>

</xsd:complexType>

您会看到差异......

You are getting that output because, Map always look for output document ( Document Y) Connections from top elment to bottom element. So in your case it will execute first elment A ( in Document Y) Links, afterthat B, after that C.

Try to modify the output doucment( Document Y) xsd to sth like this

    <xsd:complexType>
       <xsd:sequence>
          <xsd:choice minOccurs="3" maxOccurs="unbounded">
                 <xsd:element maxOccurs="unbounded" ref="D" /> 
                 <xsd:element maxOccurs="unbounded" ref="C" /> 
                 <xsd:element maxOccurs="unbounded" ref="B" /> 
                 <xsd:element minOccurs="0" maxOccurs="unbounded" ref="A"/> 
          </xsd:choice>
       </xsd:sequence>

</xsd:complexType>

You will see the difference.....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文