次のxml構造を変換したい
<so_product company="Brady Europe EN" part_number="N008153" category="Brady Europe English.Safety Identification.Pipe Markers & Valve Identification.CLP Pipe Markers" description="CLP Pipe Marker on Roll - Hydrazine 127X33RL-T3-P19" >
<image zip_file_key="1" filename="794640.jpg"/>
<so_product_attribute name="Product Number" value="Hydrazine 127X33RL-T3-P19"/>
<so_product_attribute name="QTY/UOM" value="220/Roll"/>
<so_product_attribute name="Brady Material Number" value="B-7541"/>
<so_product_attribute name="Class" value="Flamable / non flamable liquids / Oils"/>
<so_product_attribute name="Colour" value="White on Brown"/>
<so_product_attribute name="Layout" value="3"/>
<so_product_attribute name="Legend" value="Hydrazine"/>
<so_product_attribute name="Material Type" value="Laminated Polyester"/>
<so_product_attribute name="Size - Height (mm)" value="33"/>
<so_product_attribute name="Size - Width (mm)" value="127"/>
<so_product_attribute name="Type" value="DANGER"/>
<so_product_attribute name="Danger Symbol" value="CLP 2^CLP 6^CLP 8^CLP 5^CLP 9"/>
次の形式に
<?xml version="1.0" encoding="utf-8"?>
<stockItems>
<stockItem>
<reference>12345A2HC101</reference>
<stockGroup>Brady Europe English.Data Collection & RFID.Barcode Scanners & Hardware"</stockGroup>
<webListingImageUF>webFolder/images/productXSmall.gif(image@filename)</webListingImageUF>
<webListingTextOrHTML>Listing description</webListingTextOrHTML>
<webMoreInfoImageUF>webFolder/images/productXLarge.gif(image@filename)</webMoreInfoImageUF>
<webMoreInfoTextOrHTML>Long Description</webMoreInfoTextOrHTML>
</stockItem>
</stockItems>
「soproduct」は「stockItem」に変換する必要があります。属性「part_number」の値を「reference」タグに含める必要があります。「image」タグにある属性「filename」の値は、「webListingImageUF」タグなどに含める必要があります。これを行うにはどうすればよいですか?私のxmlファイルのファイルサイズは29MBで、多くの「so_product」が繰り返されます。
XPathを使用してみましたが、メモリエラーが発生しました。現在、javax.xml.streamインターフェイスXMLStreamReaderを使用してこれを試しています。ここでは、最初にタグ名を必要なタグ名に変換しました(例「so_product」を「stockItem」に、「image」を「reference」に)。 「reference」タグ内に「part_number」属性値を含めます。
私を助けてください..私は今日までにこれを提出したいと思います。