Bug #33262 Frq: ExtractValue() - user-defined delimiter
Submitted: 15 Dec 2007 20:24 Modified: 17 Dec 2007 5:53
Reporter: Hubert Roksor Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: XML functions Severity:S4 (Feature request)
Version: OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[15 Dec 2007 20:24] Hubert Roksor
As per MySQL manual,

"If multiple matches are found, then the content of the first child text node of each matching element is returned (in the order matched) as a single, space-delimited string."

I think it would be most welcome if it was possible to specify another delimiter than space, that would be passed to ExtractValue() as its third parameter. That parameter should be optional and would default to a space. The function should allow an empty string as delimiter, so that the contents of all nodes is concatenated. Ideally, the function should allow strings longer than 1 character.

Thanks for reading.

How to repeat:
Possible uses:

- with an empty delimiter, as a way to remove HTML tags from XHTML data without adding unnecessary whitespace, eg:
  ExtractValue('<p>foo<b>bar</b></p>', '//*', '')
  => 'foobar'

- with a comma, as a way to retrieve a comma-separated list of values, eg:
  ExtractValue(xmlcol, '//fullname', ',')
  => 'John Smith,John Doe'
[17 Dec 2007 5:53] Valeriy Kravchuk
Thank you for a reasnable feature request.
[23 Oct 2014 11:32] Daniƫl van Eeden
This could be a duplicate of Bug #25703