Biztalk 映射器更改节点顺序
我需要将文档 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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?
您之所以获得该输出,是因为 Map 始终查找从顶部元素到底部元素的输出文档(文档 Y)连接。因此,在您的情况下,它将执行第一个元素 A(在文档 Y 中)链接,然后执行 B,然后执行 C。
尝试将输出文档(文档 Y)xsd 修改为这样
您会看到差异......
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
You will see the difference.....