Bug #49305 XML output has poor representation of NULL values
Submitted: 1 Dec 2009 22:02 Modified: 15 Nov 2011 3:46
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.10 r4680 OS:Windows (XP)
Assigned to: CPU Architecture:Any

[1 Dec 2009 22:02] Todd Farmer
Description:
First, it's worth noting that the Export as XML function from the SQL Editor live editor differs wildly from the output generated by the mysql --xml option.  In particular, a problem is the representation of NULL, which is identical to an empty string (not-null) value:

<DATA>
	<ROW>
		<a>1</a>
		<b>1</b>
		<c>1</c>
	</ROW>
	<ROW>
		<a>2</a>
		<b>2</b>
		<c>2</c>
	</ROW>
	<ROW>
		<a>4</a>
		<b></b>
		<c>4</c>
	</ROW>
	<ROW>
		<a>3</a>
		<b></b>
		<c>0</c>
	</ROW>
</DATA>

In this case, the row a=4 has a blank string, while row a=3 has a NULL value.

Note mysql --xml output for same data:

<resultset statement="SELECT * FROM test.ci
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <row>
        <field name="a">1</field>
        <field name="b">1</field>
        <field name="c">1</field>
  </row>

  <row>
        <field name="a">2</field>
        <field name="b">2</field>
        <field name="c">2</field>
  </row>

  <row>
        <field name="a">4</field>
        <field name="b"></field>
        <field name="c">4</field>
  </row>

  <row>
        <field name="a">3</field>
        <field name="b" xsi:nil="true" />
        <field name="c">0</field>
  </row>
</resultset>

How to repeat:
Export NULL, empty strings as XML.

Suggested fix:
It sure would be nice to have identical output from our two tools which generate XML output, but it seems that using the following representation for NULL values is the minimum required:

<b/>
[15 Nov 2011 3:46] Philip Olson
Fixed as of 5.2.36:
+        Added a new format to the SQL Editor for export, which is
+        identical to the XML generated by the <literal>mysql
+        --xml</literal> command. It's titled <literal>XML (mysql
+        format)</literal>.