我有具有多個子級別的XML文件。將數據存儲到數據庫中的最佳方法是什麼?爲節點創建不同的表並保存具有關係或數據的數據?如果我們有50個不同的節點該怎麼辦?將XML數據存儲到數據庫中的最佳方法
類似XML
<storage>
<product description="Cardigan Sweater" product_image="cardigan.jpg">
<storage_item gender="Men's">
<item_number>QWZ5671</item_number>
<price>39.95</price>
<size description="Medium">
<color image="red_cardigan.jpg">Red</color>
<color image="burgundy_cardigan.jpg">Burgundy</color>
</size>
<size description="Large">
<color image="red_cardigan.jpg">Red</color>
<color image="burgundy_cardigan.jpg">Burgundy</color>
</size>
</storage_item>
<storage_item gender="Women's">
<item_number>RRX9856</item_number>
<price>42.50</price>
<size description="Small">
<color image="red_cardigan.jpg">Red</color>
<color image="navy_cardigan.jpg">Navy</color>
<color image="burgundy_cardigan.jpg">Burgundy</color>
</size>
<size description="Medium">
<color image="red_cardigan.jpg">Red</color>
<color image="navy_cardigan.jpg">Navy</color>
<color image="burgundy_cardigan.jpg">Burgundy</color>
<color image="black_cardigan.jpg">Black</color>
</size>
<size description="Large">
<color image="navy_cardigan.jpg">Navy</color>
<color image="black_cardigan.jpg">Black</color>
</size>
<size description="Extra Large">
<color image="burgundy_cardigan.jpg">Burgundy</color>
<color image="black_cardigan.jpg">Black</color>
</size>
</storage_item>
</product>
</storage>
取決於你想用它做什麼。如果你只是想存儲它並按原樣返回,請使用blob。如果您想實際處理數據,例如查找物品的平均價格,請將其分解並根據需要創建不同的表格。 – Robert