我有4个类似的xml文件。唯一的区别是价格标签。
文件1
<?xml version="1.0" encoding="UTF-8"?>
<FILE batchNo="ProductPrice_20161130120718453" changeId="1">
<ROOT transactionNo="1">
<PRICE docNo="1">
<ITEMID type="1">A210BK001</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="SGD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">333.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
<PRICE docNo="2">
<ITEMID type="1">A210BK002</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="SGD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">333.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
</ROOT>
<END_OF_BATCH/>
<END_OF_PROCESSING/>
</FILE>
文件2
<?xml version="1.0" encoding="UTF-8"?>
<FILE batchNo="ProductPrice_20161130120718453" changeId="1">
<ROOT transactionNo="1">
<PRICE docNo="1">
<ITEMID type="1">A210BK001</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="USD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">125.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
<PRICE docNo="2">
<ITEMID type="1">A210BK002</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="USD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">125.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
</ROOT>
<END_OF_BATCH/>
<END_OF_PROCESSING/>
</FILE>
文件3
<?xml version="1.0" encoding="UTF-8"?>
<FILE batchNo="ProductPrice_20161130120718453" changeId="1">
<ROOT transactionNo="1">
<PRICE docNo="1">
<ITEMID type="1">A210BK001</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="AUD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">175.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
<PRICE docNo="2">
<ITEMID type="1">A210BK002</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="AUD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">175.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
</ROOT>
<END_OF_BATCH/>
<END_OF_PROCESSING/>
</FILE>
文件4
<?xml version="1.0" encoding="UTF-8"?>
<FILE batchNo="ProductPrice_20161130120718453" changeId="1">
<ROOT transactionNo="1">
<PRICE docNo="1">
<ITEMID type="1">A210BK001</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="GBP18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">90.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
<PRICE docNo="2">
<ITEMID type="1">A210BK002</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="GBP18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">90.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
</ROOT>
<END_OF_BATCH/>
<END_OF_PROCESSING/>
</FILE>
输出文件
<?xml version="1.0" encoding="UTF-8"?>
<FILE batchNo="ProductPrice_20161130120718453" changeId="1">
<ROOT transactionNo="1">
<PRICE docNo="1">
<ITEMID type="1">A210BK001</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="AUD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">175.0</PRODUCT_PRICE>
</PRICES>
<PRICES price_band="GBP18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">90.0</PRODUCT_PRICE>
</PRICES>
<PRICES price_band="SGD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">333.0</PRODUCT_PRICE>
</PRICES>
<PRICES price_band="USD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">125.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
<PRICE docNo="2">
<ITEMID type="1">A210BK002</ITEMID>
<FROM_DATE>2016113012071800+0000</FROM_DATE>
<PRICES price_band="AUD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">175.0</PRODUCT_PRICE>
</PRICES>
<PRICES price_band="GBP18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">90.0</PRODUCT_PRICE>
</PRICES>
<PRICES price_band="SGD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">333.0</PRODUCT_PRICE>
</PRICES>
<PRICES price_band="USD18">
<PRODUCT_PRICE price_code="3" unit_of_sale_qty="1">125.0</PRODUCT_PRICE>
</PRICES>
</PRICE>
</ROOT>
<END_OF_BATCH/>
<END_OF_PROCESSING/>
</FILE>
我想从这4个不同的xmls中挑选个别价格区段并将其强制转换为单个xml。这样做的最佳方法是什么?
此类标签的数量> 4000