我有一个循环节点EthnicDet,它拥有多个现有的前国籍或公民身份(CurrentNatCit)我需要确保当前国籍地图的所有国家值都转到国籍节点,当前公民身份映射到公民身份节点,所有前国籍/公民身份映射到OtherNationality / OtherCitizenship(公民身份只允许一个记录,它是节点)。有什么想法吗?
<NationalityDet>
<NatCit>
<Type>NATIONALITY/CITIZENSHIP</Type>
<Status>CURRENT/FORMER</Status>
<Country>UK</Country>
</NatCit>
<OtherNatCit>
<Type>NATIONALITY/CITIZENSHIP</Type>
<Status>CURRENT/FORMER</Status>
<Country>UK</Country>
</OtherNatCit>
</NationalityDet>
<Person>
<Person1>
<Nationality>NATIONALITY/CURRENT</Nationality>
<Nationality>NATIONALITY/CURRENT</Nationality>
<Nationality>NATIONALITY/CURRENT</Nationality>
<Citizenship>CITIZENSHIP/CURRENT</Citizenship>
<Citizenship>CITIZENSHIP/CURRENT</Citizenship>
<Citizenship>CITIZENSHIP/CURRENT</Citizenship>
<OtherNationality>
<Nationality>NATIONALITY/FORMER</Nationality>
<Nationality>NATIONALITY/FORMER</Nationality>
<Nationality>NATIONALITY/FORMER</Nationality>
</OtherNationality>
<OtherCitizenship>CITIZENSHIP/FORMER</OtherCitizenship>
</Person1>
</Person>
目前已经使用了你提到的循环functoid和许多等号和&amp; s来允许这种映射。关于为两个不同的父节点计数TYPE = CITIZENSHIP和STATUS = FORMER for OtherCitizenship的节点,我陷入困境。有什么想法吗?
答案 0 :(得分:1)
从你的问题和样本中可以确切地知道你想要映射到哪里。
但您可能需要的模式如下。添加一个循环functoid,它同时包含单例和重复节点。添加一个迭代functoid,它等于functoid,大于functoid,第二个固定值为1,并分别映射到singleton和repeat节点。将源字段映射到两个字段。
问题更改后更新。
因此,假设您有以下XML
<NationalityDet>
<NatCit>
<Type>NATIONALITY</Type>
<Status>CURRENT</Status>
<Country>UK</Country>
</NatCit>
<NatCit>
<Type>CITIZENSHIP</Type>
<Status>CURRENT</Status>
<Country>Netherlands</Country>
</NatCit>
<NatCit>
<Type>NATIONALITY</Type>
<Status>FORMER</Status>
<Country>Brazil</Country>
</NatCit>
<NatCit>
<Type>CITIZENSHIP</Type>
<Status>FORMER</Status>
<Country>USA</Country>
</NatCit>
<OtherNatCit>
<Type>NATIONALITY</Type>
<Status>CURRENT</Status>
<Country>Australia</Country>
</OtherNatCit>
<OtherNatCit>
<Type>CITIZENSHIP</Type>
<Status>CURRENT</Status>
<Country>New Zealand</Country>
</OtherNatCit>
<OtherNatCit>
<Type>NATIONALITY</Type>
<Status>FORMER</Status>
<Country>Argentina</Country>
</OtherNatCit>
<OtherNatCit>
<Type>CITIZENSHIP</Type>
<Status>FORMER</Status>
<Country>Germany</Country>
</OtherNatCit>
</NationalityDet>
然后你的地图会是这样的。
我将解释突出显示的形状,其余的遵循相同的模式。从上到下,从左到右。
然后我复制了第一组并将NATIONALITY更改为CITIZENSHIP并链接到相同的输入字段,但将值映射的输出放到Citizenship。
然后我复制了第一个组并将CURRENT更改为FORMER并链接到相同的输入字段,但将值映射的输出放到OtherNationality \ Ethnic。
然后我复制了第二组(具有CITIZENSHIP)并将CURRENT更改为FORMER并链接到相同的输入字段,但将值映射的输出放到OtherCitenship。
以下是输出。
<Person>
<Person1>
<Nationality>UK</Nationality>
<Nationality>Australia</Nationality>
<Citizenship>Netherlands</Citizenship>
<Citizenship>New Zealand</Citizenship>
<OtherNationality>
<Nationality>Brazil</Nationality>
<Nationality>Argentina</Nationality>
</OtherNationality>
<OtherCitizenship>USA</OtherCitizenship>
<OtherCitizenship>Germany</OtherCitizenship>
</Person1>
</Person>