Jump to content

XPath Problem :(


Pesho

Recommended Posts

hi all,

 

I'm using the XPath engine of MySQL 5.1 and I have the following XML structure:

 

<a>
<b>1</b>
<c>2</c>
<d>3</d>
</a>

 

What I want to extract is the tag name of the first child of <a>, e.g. I want to extract the value "b".

I know I can access the <b> node as follows:

SELECT EXTRACTVALUE(columnName,'/a/child::*[1]') from tableName;

This gives me the fist child's text, e.g. "1", but I can't figure out how to get its tag name.

 

I would be extremely grateful for any hint you could give!

 

Regards,

Pesho

 

Link to comment
https://forums.phpfreaks.com/topic/46996-xpath-problem/
Share on other sites

I got the following information from the mysql website:

 

Note that ExtractValue() returns only CDATA, and does not return any tags that might be contained within a matching tag, nor any of their content (see the result returned as val1 in the following example).

 

http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html#function_extractvalue

Link to comment
https://forums.phpfreaks.com/topic/46996-xpath-problem/#findComment-229427
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.