Bug #25946 Namespace not include for xsi usage within --xml output with null/nil values
Submitted: 30 Jan 2007 16:14 Modified: 3 Apr 2007 2:05
Reporter: Mark Leith
Status: Closed
Category:Server: XML Severity:S2 (Serious)
Version:5.0.26, 5.1.12 OS:Any (All)
Assigned to: Alexander Barkov Target Version:
Tags: bfsm_2007_03_15, MySQL, XML, xsi

[30 Jan 2007 16:14] Mark Leith
Description:
The namespace is not included along with the new xsi usage within the --xml formatted
output of the mysql command line client (and mysqldump as well). This breaks
compatilibity for various tools that use things such as the SAXParser. For instance the
new format of something like SHOW SLAVE STATUS:

<resultset statement="SHOW SLAVE STATUS">
<row>
<field name="Slave_IO_State"></field>
<field name="Master_Host">somehost.com</field>
<field name="Master_User">slave</field>
<field name="Master_Port">3306</field>
<field name="Connect_Retry">30</field>
<field name="Master_Log_File">log-bin.000001</field>
<field name="Read_Master_Log_Pos">1056</field>
<field name="Relay_Log_File">log-relay.000002</field>
<field name="Relay_Log_Pos">254</field>
<field name="Relay_Master_Log_File">log-bin.000001</field>
<field name="Slave_IO_Running">No</field>
<field name="Slave_SQL_Running">No</field>
<field name="Replicate_Do_DB"></field>
<field name="Replicate_Ignore_DB"></field>
<field name="Replicate_Do_Table"></field>
<field name="Replicate_Ignore_Table"></field>
<field name="Replicate_Wild_Do_Table"></field>
<field name="Replicate_Wild_Ignore_Table"></field>
<field name="Last_Errno">137</field>
<field name="Last_Error"></field>
<field name="Skip_Counter">0</field>
<field name="Exec_Master_Log_Pos">420</field>
<field name="Relay_Log_Space">1966</field>
<field name="Until_Condition">None</field>
<field name="Until_Log_File"></field>
<field name="Until_Log_Pos">0</field>
<field name="Master_SSL_Allowed">No</field>
<field name="Master_SSL_CA_File"></field>
<field name="Master_SSL_CA_Path"></field>
<field name="Master_SSL_Cert"></field>
<field name="Master_SSL_Cipher"></field>
<field name="Master_SSL_Key"></field>
<field name="Seconds_Behind_Master" xsi:nil="true" />
</row>
</resultset>

Now breaks parsers with errors such as:

"The prefix "xsi" for attribute "xsi:nil" associated with an element type "field" is not
bound."

How to repeat:
No test case immediately available, easy to see where the issue is.

Suggested fix:
Provide the correct namespace within the XML output, such as:

 <resultset statement="SHOW SLAVE STATUS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<row>
<field name="Slave_IO_State"></field>
<field name="Master_Host">somehost.com</field>
<field name="Master_User">slave</field>
<field name="Master_Port">3306</field>
<field name="Connect_Retry">30</field>
<field name="Master_Log_File">log-bin.000001</field>
<field name="Read_Master_Log_Pos">1056</field>
<field name="Relay_Log_File">log-relay.000002</field>
<field name="Relay_Log_Pos">254</field>
<field name="Relay_Master_Log_File">log-bin.000001</field>
<field name="Slave_IO_Running">No</field>
<field name="Slave_SQL_Running">No</field>
<field name="Replicate_Do_DB"></field>
<field name="Replicate_Ignore_DB"></field>
<field name="Replicate_Do_Table"></field>
<field name="Replicate_Ignore_Table"></field>
<field name="Replicate_Wild_Do_Table"></field>
<field name="Replicate_Wild_Ignore_Table"></field>
<field name="Last_Errno">137</field>
<field name="Last_Error"></field>
<field name="Skip_Counter">0</field>
<field name="Exec_Master_Log_Pos">420</field>
<field name="Relay_Log_Space">1966</field>
<field name="Until_Condition">None</field>
<field name="Until_Log_File"></field>
<field name="Until_Log_Pos">0</field>
<field name="Master_SSL_Allowed">No</field>
<field name="Master_SSL_CA_File"></field>
<field name="Master_SSL_CA_Path"></field>
<field name="Master_SSL_Cert"></field>
<field name="Master_SSL_Cipher"></field>
<field name="Master_SSL_Key"></field>
<field name="Seconds_Behind_Master" xsi:nil="true" />
</row>
</resultset>
[27 Mar 2007 10:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/22983
[28 Mar 2007 10:22] Sergey Vojtovich
Approved.
[28 Mar 2007 12:28] Alexander Barkov
Pushed into 5.0.38
Pushed into 5.1.17
[1 Apr 2007 1:53] Bugs System
Pushed into 5.0.40
[1 Apr 2007 1:55] Bugs System
Pushed into 5.1.18-beta
[3 Apr 2007 2:05] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of
that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available
version, including the bug fix. More information about accessing the source trees is
available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.0.40 and 5.1.18 changelogs. Also updated info in descriptions of
mysql and mysqldump.
[3 Apr 2007 11:59] Ruvim Pinka
Also see Bug #27608 (If a result set is empty, the output XML document is utterly blank
while it must include at least one empty root element).