Hãy tha thứ cho sự thiếu kiến thức của tôi ... Tôi biết có rất nhiều tài liệu trên internet liên quan đến điều này nhưng tôi vẫn không hiểu.Nhập XML vào MySQL 5.1
Tình huống của tôi là:
Tôi có tệp XML mà tôi cần nhập và cuối cùng thay thế hàng ngày bằng.
<item>
<model>AA311-Pink</model>
<title>1122</title>
<price>19.43</price>
<category>cat</category>
<loc>/AA311.html</loc>
<image>/aa311.jpg</image>
<description>Item Info</description>
<weight>0.45</weight>
<option_type>Color-Color</option_type>
<option_value>Pink-Pink</option_value>
<suggested_retail>51.50</suggested_retail>
<special_handling/>
<manufacturer>Tantus</manufacturer>
<manufacturer_code>VB5074 and VB5067</manufacturer_code>
<packaging>Retail Packaging</packaging>
<in_stock>Yes</in_stock>
<lastupdated>2008-11-05 16:35:56</lastupdated>
Tôi cần thay đổi một số tên cột tự động và nhập chúng vào nhiều bảng trong cơ sở dữ liệu của tôi.
Ví dụ,
<item>
<products_model>AA315</products_model>
<products_name>name</products_name>
<price>19.43</price>
<category>cat</category>
<loc>/AA315.html</loc>
<products_image>aa315.jpg</products_image>
<products_description>info</products_description>
<products_weight>0.44</products_weight>
<option_type/>
<option_value/>
<products_price>51.50</products_price>
<special_handling/>
<manufactures_name>Tantus</manufactures_name>
<manufacturer_code>VA5104</manufacturer_code>
<packaging>Retail Packaging</packaging>
<products_status>Yes</products_status>
<products_last_modified>2008-11-05 16:35:27</products_last_modified>
Và sau đó nhập vào MySQL DB
Cột: products_weight, products_model, products_image, products_price, products_last_modified
nhập khẩu vào bảng 'sản phẩm'
Cột: products_description, products_name
nhập vào bảng 'product_description
Còn về product_id được tạo tự động thì sao? Tôi có thể gửi đầu ra SQL của cấu trúc bảng.
Tôi thực sự đánh giá cao sự trợ giúp ... Tôi sẵn sàng trả một số nếu họ sẵn sàng tạo một thủ tục hoàn toàn tự động để nhập tệp này vào cơ sở dữ liệu của tôi; Tôi đang sử dụng Zen Cart để lưu trữ giỏ hàng của mình.
Câu hỏi đã đề cập đến phiên bản MySQL 5.1, trong đó 'LOAD XML' không được hỗ trợ. – mxgr
Xin lỗi. Lỗi của tôi. –