Bug #65227 ExtractValue() strips embedded quotes from attribute values
Submitted: 7 May 2012 16:58 Modified: 4 Dec 2014 20:35
Reporter: David Berg Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:5.5.22, 5.1.64, 5.5.25, 5.6.6 OS:Windows (7)
Assigned to: CPU Architecture:Any
Tags: attribute values, embedded quotes, ExtractValue

[7 May 2012 16:58] David Berg
Description:
ExtractValue() correctly extracts escaped embedded quotes contained in element values ...

   ExtractValue("<a><b>\"12345\"</b></a>","/a/b") = "12345"

but strips embedded escaped quotes contained in attribute values ...

   ExtractValue("<a b=\"12345\"></a>","/a/@b") = 12345

Embedded quotes should be retained as an integral component of a value string no matter where it appears.

How to repeat:
SELECT ExtractValue("<a><b>\"12345\"</b></a>","/a/b"); Result = "12345".

SELECT ExtractValue("<a b=\"12345\"></a>","/a/@b"); Result = 12345.

Suggested fix:
Extract and retain escaped embedded quotes contained in attribute values.
[8 May 2012 19:07] Sveta Smirnova
Thank you for the report.

Verified as described.
[16 Jun 2012 19:35] David Berg
I humbly withdraw this bug report. Attribute values are required to be enclosed in quotes; thus their surrounding quotes are not 'embedded' and should not be returned as component characters in the extracted value. It would appear, in fact, that attribute values may not contain embedded quotes.
[23 Oct 2014 11:18] Daniƫl van Eeden
To me it looks like this bug should be closed?
[24 Oct 2014 18:24] David Berg
Yes.
[4 Dec 2014 20:35] Sveta Smirnova
Thank you for the feedback.

Closing as "Not a Bug"