将大型XML文件导入MySQL

时间:2017-05-05 08:16:33

标签: mysql xml xslt

我正在尝试将XML文件导入MySQL。我已经看到了一些已经在这里提出的问题,我已经介绍了其中的一些问题。

这是因为它是由客户端提供的,并且改变这将不是一个简单或快速的选项,所以当我等待更好的feed文件时,我将尝试使这项工作。希望从这里获得一些史诗般的帮助。

XML文件示例:

<Feed>

<Product>
  <ProductCode>139244AAAZ4</ProductCode>
  <DisplayName>Men's Adidas Stan Smith Lifestyle Shoe</DisplayName>
  <URL>http://www.totalsports.co.za/pdp/Men's-Adidas-Stan-Smith-Lifestyle-Shoe/_/A-139244AAAZ4</URL>
  <ProductCategory>Court Inspired</ProductCategory>
  <Description>Created in 1971 for tennis star Stan Smith, this clean-cut men's shoe holds a special place in style history. A smooth full grain leather upper with perforated 3-Stripes and tonal rubber outsole have made this low top into a celebrated sneaker icon.</Description>
  <ImageURL>tfgsrv.wigroup.co/13/Detail/31417802.jpg</ImageURL>
  <latestSellingPrice>764.00</latestSellingPrice>
  <Brand>Totalsports</Brand>
  <ColourDescription>White</ColourDescription>
  <ColourId>31417802</ColourId>
  <SizeId>31417807</SizeId>
  <SkuDisplayName>10</SkuDisplayName>
  <StockAvailable>0</StockAvailable>
</Product>

<Product>
  <ProductCode>139259AABC1</ProductCode>
  <DisplayName>Junior Grade School Nike Air Devosion Shoe</DisplayName>
  <URL>http://www.totalsports.co.za/pdp/Junior-Grade-School-Nike-Air-Devosion-Shoe/_/A-139259AABC1</URL>
  <ProductCategory>Other Basketball</ProductCategory>
  <Description>The Boys' Nike Air Devosion (GS) Boys' Basketball Shoe rethinks the conventional high-top, with a dynamic collar designed to adapt to the constant movement and repositioning of your ankle during play.</Description>
  <ImageURL>tfgsrv.wigroup.co/13/Detail/31507661.jpg</ImageURL>
  <latestSellingPrice>899.00</latestSellingPrice>
  <Brand>Totalsports</Brand>
  <ColourDescription>Black/White</ColourDescription>
  <ColourId>31507661</ColourId>
  <SizeId>31507665</SizeId>
  <SkuDisplayName>2</SkuDisplayName>
  <StockAvailable>0</StockAvailable>
</Product>

</Feed>

LOAD XML是否能够以这种格式处理XML文件,这是我第一次使用该函数,而且我已经阅读过它将无法使用它。我是否需要首先使用XSL转换XML?

但是我还要问一下,在服务器根目录中为INLINE LOCAL函数存储文件的正确位置在哪里?

  

LOAD XML INFILE LOCAL'TotalSports产品提取物50k Part 1.xml'   INTO TABLE XML_Import

或者是否有其他方法可以定期自动将此类数据导入MySQL?这个XML文件超过40mb,大文件来了。

提前致谢!

0 个答案:

没有答案