将XML文件加载到MySql中

时间:2016-02-24 17:57:49

标签: mysql xml

我想将以下XML加载到我创建的表中。

CREATE TABLE tempfighters(
fighterId INTEGER auto_increment,
dateCreated TIMESTAMP,
dateUpdated TIMESTAMP,
id VARCHAR(300),
first_name VARCHAR (30),
last_name VARCHAR (30),
nick_name VARCHAR(30),
height INTEGER,
weight INTEGER,
reach INTEGER,
stance VARCHAR(100),
 constraint tempfighters_pk
PRIMARY KEY (fighterId)
 );

<profile generated="2016-02-23T23:44:08Z"     
xmlns="http://feed.elasticstats.com/schema/mma/v1/participants-profile.xsd">
<fighters>
<fighter id="01585452-852a-4b40-a6dc-fdd04279f02c" height="72" weight="170"       
   reach="" stance="" first_name="Sai" nick_name="The Boss" last_name="Wang">
  <record wins="6" losses="4" draws="1" no_contests="0"/>
  <born date="1988-01-16" country_code="UNK" country="Unknown" state=""      
   city=""/>
  <out_of country_code="UNK" country="Unknown" state="" city=""/>

我的代码无效,我确定为什么

LOAD XML LOCAL INFILE "c:\....."
INTO TABLE tempfighters(first_name, last_name, nick_name, height, weight,     reach, stance)
ROWS IDENTIFIED BY "<fighter>"

我没有正确地指出&#34;战斗机内的属性&#34;?我是否需要调整战斗机&#34;是一个儿童节点?

0 个答案:

没有答案