来自2个xml文件我希望生成一个新的xml文件。请注意4103700和4103701是第一个xml的密钥。基于此我需要从第二个xml中选择值。
第一个XML文件:
<B2BXo856ShipmentCollection xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/dbService">
<B2BXo856Shipment>
<shipPk>3165760</shipPk>
<customerNumber>250117</customerNumber>
<shipperNumber>188884001</shipperNumber>
<b2BXo856CartonCollection>
<B2BXo856Carton>
<cartonPk>4103700</cartonPk>
<numberOfBoxes>6</numberOfBoxes>
<cartonWeight>4</cartonWeight>
</B2BXo856Carton>
<B2BXo856Carton>
<cartonPk>4103701</cartonPk>
<numberOfBoxes>6</numberOfBoxes>
<cartonWeight>4</cartonWeight>
</B2BXo856Carton>
</b2BXo856CartonCollection>
</B2BXo856Shipment>
</B2BXo856ShipmentCollection>
第二个XML文件:
<dbReferenceOutputCollection xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/dbReference">
<dbReferenceOutput>
<carton_fk>4103700</carton_fk>
<date_code>1701</date_code>
<SUM_NUMBER_PARTS_PER_BOX_>100</SUM_NUMBER_PARTS_PER_BOX_>
</dbReferenceOutput>
<dbReferenceOutput>
<carton_fk>4103700</carton_fk>
<date_code>1705</date_code>
<SUM_NUMBER_PARTS_PER_BOX_>800</SUM_NUMBER_PARTS_PER_BOX_>
</dbReferenceOutput>
<dbReferenceOutput>
<carton_fk>4103701</carton_fk>
<date_code>1703</date_code>
<SUM_NUMBER_PARTS_PER_BOX_>130</SUM_NUMBER_PARTS_PER_BOX_>
</dbReferenceOutput>
<dbReferenceOutput>
<carton_fk>4103701</carton_fk>
<date_code>1707</date_code>
<SUM_NUMBER_PARTS_PER_BOX_>500</SUM_NUMBER_PARTS_PER_BOX_>
</dbReferenceOutput>
<dbReferenceOutput>
<carton_fk>4103701</carton_fk>
<date_code>1710</date_code>
<SUM_NUMBER_PARTS_PER_BOX_>500</SUM_NUMBER_PARTS_PER_BOX_>
</dbReferenceOutput>
</dbReferenceOutputCollection>
预期结果:
<?xml version = '1.0' encoding = 'UTF-8'?>
<tns:Pip3B2AdvanceShipmentNotification xmlns:tns="http://www.edifecs.com/RosettaNet/100">
<tns:AdvancedShipmentNotification>
<tns:Shipment>
<tns:ShippingContainer>
<tns:LinearPhysicalDimension>
<tns:GlobalPhysicalUnitOfMeasureCode>4103700</tns:GlobalPhysicalUnitOfMeasureCode>
</tns:LinearPhysicalDimension>
<tns:ShippingContainerItem>
<tns:DocumentSubLineLotShipReference>
<tns:GlobalDocumentReferenceTypeCode>1701</tns:GlobalDocumentReferenceTypeCode>
</tns:DocumentSubLineLotShipReference>
<tns:DocumentSubLineLotShipReference>
<tns:GlobalDocumentReferenceTypeCode>1705</tns:GlobalDocumentReferenceTypeCode>
</tns:DocumentSubLineLotShipReference>
</tns:ShippingContainerItem>
</tns:ShippingContainer>
<tns:ShippingContainer>
<tns:LinearPhysicalDimension>
<tns:GlobalPhysicalUnitOfMeasureCode>4103701</tns:GlobalPhysicalUnitOfMeasureCode>
</tns:LinearPhysicalDimension>
<tns:ShippingContainerItem>
<tns:DocumentSubLineLotShipReference>
<tns:GlobalDocumentReferenceTypeCode>1703</tns:GlobalDocumentReferenceTypeCode>
</tns:DocumentSubLineLotShipReference>
<tns:DocumentSubLineLotShipReference>
<tns:GlobalDocumentReferenceTypeCode>1707</tns:GlobalDocumentReferenceTypeCode>
</tns:DocumentSubLineLotShipReference>
<tns:DocumentSubLineLotShipReference>
<tns:GlobalDocumentReferenceTypeCode>1710</tns:GlobalDocumentReferenceTypeCode>
</tns:DocumentSubLineLotShipReference>
</tns:ShippingContainerItem>
</tns:ShippingContainer>
</tns:Shipment>
</tns:AdvancedShipmentNotification>
</tns:Pip3B2AdvanceShipmentNotification>
对于第一个键,第二个键中有2个值,第二个键中有3个值。
任何帮助或指示赞赏。感谢