Import xml with short tags into mysql

jackburaks

New Member
I need to load some xml files into a mysql database..I did it using \[code\]LOAD XML\[/code\] and it works fine.. but sometimes I have some xml with short code in it and it did not work...If I use the following statement:\[code\]load xml local infile 'D:\\file_xml.xml' into table book rows identified by '<Book>'\[/code\]and I have a \[code\]book\[/code\] table with \[code\]ID\[/code\], \[code\]TITLE\[/code\], \[code\]PRICE\[/code\] columns..If the xml is like:\[code\]<Books> <Book> <ID>1</ID> <TITLE>Test1</TITLE> <PRICE></PRICE> </Book> <Book> <ID>2</ID> <TITLE>Test2</TITLE> <PRICE>123</PRICE> </Book></Books>\[/code\]The above table is filled correctly...\[code\]ID - TITLE - PRICE1 - Test1 - 2 - Test2 - 123\[/code\]Otherwise if I have an xml file like:\[code\]<Books> <Book> <ID>1</ID> <TITLE>Test1</TITLE> <PRICE /> </Book> <Book> <ID>2</ID> <TITLE /> <PRICE>123</PRICE> </Book></Books>\[/code\]The table is not filled properly and I will have\[code\]ID - TITLE - PRICE1 - Test1 - 2 - 123 -\[/code\]Is there any way to fix this behaviour?Help!!!
 
Back
Top