如何将嵌套的xml文件导入数据库 [英] How to import a nested xml file into database

查看:105
本文介绍了如何将嵌套的xml文件导入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

温馨的问候!

我陷入了问题&将xml文件导入到mysql表中. XML文件是嵌套的.我设法以某种方式创建了表,并从XML文件本身中提取了适当的列以适合数据类型,但是我没有任何想法如何将嵌套的XML文件导入到表中.


Hello everyone,

Warm Regards!

I''m stuck with a problem & that is importing an xml file into a mysql table. The XML file is nested. Somehow I managed to create the table with appropriate columns taken from XML file itself to suit the datatype but I don''t have any Idea how do I import a nested XML file into the table.


<Data>
<supplyupdate>
  <a001>wiley.com-9780442205676</a001>
  <a002>12</a002>
  <productidentifier>
    <b221>03</b221>
    <b244>9780442205676</b244>
  </productidentifier>
  <b394>07</b394>
  <b003>19890201</b003>
  <supplydetail>
    <supplieridentifier>
      <j345>07</j345>
      <b244>0141534</b244>
    </supplieridentifier>
    <supplieridentifier>
      <j345>06</j345>
      <b244>5030670141531</b244>
    </supplieridentifier>
    <website>
      <b367>02</b367>
      <b295>http://www.wiley.com/WileyCDA/WileyTitle/productCd-0442205678.html</b295>
    </website>
    <j292>01</j292>
    <j397>WORLD</j397>
    <j140>AS AG AR AU BS BD BB BM BO BV BR BZ VG BN MM CA KY LK CL CN TW CO CR CU DO EC SV FK GS FJ GD GP GT GY HT HN HK IN ID IQ JM JO KP KR LA LB MY MQ MX MS NP AN AW NZ NI UM PA PG PY PE PH PR KN AI LC PM VC SG SD PM SR SY TH TT TC EG US VI UY VE YE</j140>
    <j399>The European Distribution Centre (EDC) typically supplies product to Europe, Middle-East, Africa (EMEA). Other territories are supplied by other worldwide Wiley subsidiaries. Please refer to http://www.wiley.com</j399>
    <j396>51</j396>
    <price>
      <j148>07</j148>
      <j150>AWILE100</j150>
      <j151>50.5</j151>
      <j152>GBP</j152>
      <j153>Z</j153>
      <j154>00</j154>
      <j155>50.5</j155>
      <j156>00</j156>
    </price>
    <price>
      <j148>07</j148>
      <j150>AWILE100</j150>
      <j151>69.95</j151>
      <j152>USD</j152>
      <j153>Z</j153>
      <j154>00</j154>
      <j155>69.95</j155>
      <j156>00</j156>
    </price>
    <price>
      <j148>07</j148>
      <j150>AWILE100</j150>
      <j151>82.3</j151>
      <j152>EUR</j152>
      <j153>Z</j153>
      <j154>00</j154>
      <j155>82.3</j155>
      <j156>00</j156>
    </price>
  </supplydetail>
</supplyupdate>
</Data>



如果有人知道如何制作,那么请,我非常感谢!!

我想补充一点,该文件的大小有点大,超过400 MB.

问候,
Sunny K



If anyone knows how to make it then please, I appreciate any help !!

I''d like to add that the file is a bit large in size of 400+MB.

Regards,
Sunny K

推荐答案

为什么不能解析xml并将数据推送到表中.

请参考以下链接,给出有关如何解析xml的想法

解析XML
读取XML [ ^ ] [添加XML [
why can''t you parse the xml and push the data to the table.

Refer the following link gives an idea on how to parse an xml

Parse XML
Read XML[^][^]
Prase XML[^]


这篇关于如何将嵌套的xml文件导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆