Bug #16311 XML: extractvalue() handles quoted values badly
Submitted: 9 Jan 2006 23:16 Modified: 27 Feb 2006 7:36
Reporter: Peter Gulutzan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:5.1.5-alpha-debug OS:Linux (SUSE 10.0)
Assigned to: Alexander Barkov CPU Architecture:Any

[9 Jan 2006 23:16] Peter Gulutzan
Description:
With extractvalue(), if I have a value </d> inside "quotes",
it shouldn't be parsed, it's part of the value.
Also, quotes should be stripped on retrieval.

How to repeat:
mysql> select extractvalue('<d>"</d>"</d>','/d');
+------------------------------------+
| extractvalue('<d>"</d>"</d>','/d') |
+------------------------------------+
| NULL                               |
+------------------------------------+
1 row in set (0.00 sec)

mysql> select extractvalue('<book><title>"quote"</title></book>','/book/title');
+-------------------------------------------------------------------+
| extractvalue('<book><title>"quote"</title></book>','/book/title') |
+-------------------------------------------------------------------+
| "quote"                                                           |
+-------------------------------------------------------------------+
1 row in set (0.00 sec)
[27 Feb 2006 7:36] Alexander Barkov
This is not a bug.
Quote does not have any special meaning. So </d> inside quotes must be parsed,
it is not a part of the value, it is a normal closing tag.

This is a correct XML:

<a><b>"</b>"</a>

The first quote character belongs to 'a.b'
The second quite character belongs to 'a'
The </b> sequence between quotes is a normal closing tag.