Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.


XML
<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>


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
Posted
Updated 7-Jun-12 19:08pm
v2

1 solution

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[^]
 
Share this answer
 
Comments
Sunny_Kumar_ 8-Jun-12 3:40am    
Hi Satish,
I appreciate your help, but I've already gone through these links and couldn't figure out the solution to achieve the purpose. can you please demonstrate a sample for doing this for a nested XML file?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900