PDA

View Full Version : XPath Problem - can't get the tag name of a node...


Pesho
04-14-2007, 04:25 PM
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