I've got a mapping issue which I'm trying to solve in the mapping tool of BizTalk.
Consider the following input file:
<person>
<ID>APersonID</ID>
<relatives>
<relative>
<name>Relative name 1</name>
</relative>
<relative>
<name>Relative name 2</name>
</relative>
</relatives>
</person>
Note: minOccurs of the relative element is set to 0 and the maxOccurs of the relative element is set to unbounded.
This input should be mapped to the following output:
<relatives>
<person>
<ID>APersonID</ID>
<relative>Relative name 1</relative>
</person>
<person>
<ID>APersonID</ID>
<relative>Relative name 2</relative>
</person>
<relatives>
Note: The person element has a minOccurs of 1 and a maxOccurs of unbounded.
I've got the mapping to work with a Looping functoid that links the relative element of the input file to the person element in the output file.But now there is a situation in which I'm given the following input file:
<person>
<ID>APersonID</ID>
<relatives />
</person>
Which should be mapped to
<relatives>
<person>
<ID>APersonID</ID>
</person>
<relatives>
My current mapping can't handle this situation. Can somebody give suggestions on how to make/edit the mapping so that both situations can work?