BizTalk中多个子记录映射解决办法
From:http://www.cnblogs.com/isMe/archive/2006/07/07/445289.aspx
原Xml是
 <?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
 <ns0:AttachmentList xmlns:ns0="http://BizTalk_Server_Project3.Schema1">
<ns0:AttachmentList xmlns:ns0="http://BizTalk_Server_Project3.Schema1">
 <Attachment filename="111" filetype="222" filesize="333" >jhtchina</Attachment>
  <Attachment filename="111" filetype="222" filesize="333" >jhtchina</Attachment> 
 <Attachment filename="444" filetype="555" filesize="333" >jhtchina1</Attachment>
  <Attachment filename="444" filetype="555" filesize="333" >jhtchina1</Attachment> 
 <Attachment filename="666" filetype="555" filesize="999" >jhtchina1</Attachment>
  <Attachment filename="666" filetype="555" filesize="999" >jhtchina1</Attachment>  
 </ns0:AttachmentList>
目标
</ns0:AttachmentList>
目标
 <?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
 <ns0:附件列表 xmlns:ns0="http://BizTalk_Server_Project3.Schema2">
<ns0:附件列表 xmlns:ns0="http://BizTalk_Server_Project3.Schema2">
 <附件 文件名称="111" 文件属性="222" 文件大小="333">jhtchina</附件>
<附件 文件名称="111" 文件属性="222" 文件大小="333">jhtchina</附件>
 <附件 文件名称="444" 文件属性="555" 文件大小="333">jhtchina1</附件>
<附件 文件名称="444" 文件属性="555" 文件大小="333">jhtchina1</附件>
 <附件 文件名称="666" 文件属性="555" 文件大小="999">jhtchina1</附件>
<附件 文件名称="666" 文件属性="555" 文件大小="999">jhtchina1</附件>
 </ns0:附件列表>
</ns0:附件列表>
需要将上面英文的转变成下面对应的中文,由于上面Attachment个数不确定,采用了很多方式都没有实现。
1.利用工具栏中“批量复制”控件后,进行转换后,生成的目标XML仍为原来的英文格式没有变化
2.后来采用“循环”控件,进行转换后,只是将第一条转换,其余的信息都丢失,后来请教微软的专家后知道,需要在源Schema的Attachment和目标Schema的“附件”中的属性需要设置max occurs和min occurs值为*,设置完成一切OK.

原Xml是
 <?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?> <ns0:AttachmentList xmlns:ns0="http://BizTalk_Server_Project3.Schema1">
<ns0:AttachmentList xmlns:ns0="http://BizTalk_Server_Project3.Schema1"> <Attachment filename="111" filetype="222" filesize="333" >jhtchina</Attachment>
  <Attachment filename="111" filetype="222" filesize="333" >jhtchina</Attachment>  <Attachment filename="444" filetype="555" filesize="333" >jhtchina1</Attachment>
  <Attachment filename="444" filetype="555" filesize="333" >jhtchina1</Attachment>  <Attachment filename="666" filetype="555" filesize="999" >jhtchina1</Attachment>
  <Attachment filename="666" filetype="555" filesize="999" >jhtchina1</Attachment>   </ns0:AttachmentList>
</ns0:AttachmentList> <?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?> <ns0:附件列表 xmlns:ns0="http://BizTalk_Server_Project3.Schema2">
<ns0:附件列表 xmlns:ns0="http://BizTalk_Server_Project3.Schema2"> <附件 文件名称="111" 文件属性="222" 文件大小="333">jhtchina</附件>
<附件 文件名称="111" 文件属性="222" 文件大小="333">jhtchina</附件> <附件 文件名称="444" 文件属性="555" 文件大小="333">jhtchina1</附件>
<附件 文件名称="444" 文件属性="555" 文件大小="333">jhtchina1</附件> <附件 文件名称="666" 文件属性="555" 文件大小="999">jhtchina1</附件>
<附件 文件名称="666" 文件属性="555" 文件大小="999">jhtchina1</附件> </ns0:附件列表>
</ns0:附件列表>需要将上面英文的转变成下面对应的中文,由于上面Attachment个数不确定,采用了很多方式都没有实现。
1.利用工具栏中“批量复制”控件后,进行转换后,生成的目标XML仍为原来的英文格式没有变化
2.后来采用“循环”控件,进行转换后,只是将第一条转换,其余的信息都丢失,后来请教微软的专家后知道,需要在源Schema的Attachment和目标Schema的“附件”中的属性需要设置max occurs和min occurs值为*,设置完成一切OK.

 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号