Jump to content

MySQL 5.1 - XPath Question


Pesho

Recommended Posts

Hi all,

 

For my project I have to use the new MySQL 5 built-in XPath Support.

 

However, I've come across the following problem:

Sometimes XML documents have several tags of the same type. For example:

 

<book>

<author>a1</author>

<author>a2</author>

<author>a3</author>

<book>

 

to query for the authors I use: select ExtractValue(column_name, 'book/author') from table_name;

 

it returns all the authors, separated with white space as follows: a1 a2 a3

 

This is pretty inconvenient for parsing if a single author has two names.

 

So, do you know any way to make MySQL return the result with any other separator string, except for white space.

 

Or maybe any other approach to extract the different authors using PHP???

 

 

I'd be very grateful if you can help!!!

 

 

Regards,

Pesho

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.