MySQL Forums
Forum List  »  Connector/Node.js

Re: Help requiring loading XML data into MySQL v5.0
Posted by: Harald Groven
Date: December 07, 2008 05:34PM

you should load each entity (in your case movie) in each row, not split by \n

LOAD DATA INFILE 'path.xml'
INTO TABLE `xyz`
FIELDS TERMINATED BY 'blablablabla' -- any nonexisting string
LINES TERMINATED BY '</movie>'
;

You can later create the field by

SELECT
EXTRACTVALUE(column1, '/movie/id') AS id,
EXTRACTVALUE(column1, '/movie/imdb_url') AS imdb_url,
EXTRACTVALUE(column1, '/movie/cast/actor[1]')
FROM xyz
;

Options: ReplyQuote


Subject
Written By
Posted
Re: Help requiring loading XML data into MySQL v5.0
December 07, 2008 05:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.