WL#1397: convert XML -> SQL
Affects: Server-5.5
—
Status: Complete
SUMMARY ------- As a complement to --xml mode of mysqldump (and mysql) we can provide an XSL that converts our XML dump to valid SQL dump. As far as I understand it should be rather easy. DECISIONS REGARDING THIS WL --------------------------- - Jeffrey has decided that this is not for 5.1. Lars thinks this should be planned for 5.2. -- Lars, 2007-02-21
Please find the original information from the contributor here:
http://lists.mysql.com/internals/34169
http://lists.mysql.com/internals/34170
The final syntax is a little bit different:
LOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[CHARACTER SET charset_name]
[ROWS IDENTIFIED BY 'row_tag']
[IGNORE number [LINES|ROWS]]
[(col_name_or_user_var,...)]
[SET col_name = expr,...)]
Difference comparing to the original Erik's patch:
1. "IGNORE 10 ROWS" is also understood as a synonym to "IGNORE 10 LINES",
because "lines" is something not well applicable to XML.
Note, as a side effect "IGNORE 10 ROWS" also works in "LOAD DATA" syntax.
2. "ROWS IDENTIFIER BY" is optional. The default tag is ''.
3. "CHARACTER SET charset_name" is also possible, like in "LOAD DATA".
LLD is found in the contributed patches for this feature. There's a contributed patch from Erik Wetterberg implementing "LOAD XML" syntax, hardcoded to understand only the format of "mysqldump --xml" output, but doing it very efficiently: http://lists.mysql.com/commits/20059 There's also not-so-efficient XPath-based solution, but it is not restricted to only "mysqldump --xml" format, and can load data from any XML files, which can be useful to import data from third party applications: http://lists.mysql.com/commits/20060
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.