输入 XML
<ClientInformation>
<FirstName>Ram</FirstName>
<LastName>Shah</LastName>
<MiddleName></MiddleName>
<DateOfBirth>01/01/1972</DateOfBirth>
<TaxIdentification>12346</TaxIdentification>
<RelationshipToInsuredCT>Spouse</RelationshipToInsuredCT>
<RelationshipToEmployeeCT>Spouse</RelationshipToEmployeeCT>
<RoleTypeCT>Insured</RoleTypeCT>
</ClientInformation>
输出 XML
<ContractClientVO>
<ConstantElement1></ConstantElement1>
<ConstantElement2></ConstantElement2>
<RelationshipToInsuredCT>Spouse</RelationshipToInsuredCT>
<RelationshipToEmployeeCT>Spouse</RelationshipToEmployeeCT>
<ClientRoleVO>
<ClientRoleConstantElement1></ClientRoleConstantElement1>
<RoleTypeCT>Insured</RoleTypeCT>
<ClientDetailVO>
<FirstName>Ram</FirstName>
<LastName>Shah</LastName>
<MiddleName></MiddleName>
<DateOfBirth>01/01/1972</DateOfBirth>
<TaxIdentification>12346</TaxIdentification>
</ClientDetailVO>
<ClientRoleVO>
</ContractClientVO>
用于映射参考的 XML
<ClientInformation>
<ContractClientVO>
<AssignmentReasonCT></AssignmentReasonCT>
<Associated></Associated>
<AuthorizedSignatureCT></AuthorizedSignatureCT>
<ClassCT></ClassCT>
<RelationshipToInsuredCT></RelationshipToInsuredCT>
<RelationshipToEmployeeCT></RelationshipToEmployeeCT>
<ClientRoleVO>
<AgentFK></AgentFK>
<Associated></Associated>
<RoleTypeCT></RoleTypeCT>
<ClientDetailVO>
<address></address>
<city></city>
<state></state>
<Amount></Amount>
<CountryTypeCT></CountryTypeCT>
<AmountOfInsurance></AmountOfInsurance>
<FirstName></FirstName>
<LastName></LastName>
<TaxIdentification></TaxIdentification>
</ClientDetailVO>
</ClientRoleVO>
</ContractClientVO>
</ClientInformation>
所以第三个xml供参考。它有助于定义输出 xml 的结构。
Groovy 是否有针对此类问题的开箱即用解决方案?或者我已经通过每个input xml
元素并使用reference xml
.