Re: How to select an XML attribut with SQL
Hi!
XPath denotes attributes with the '@' sign, like this:
mysql> SELECT ExtractValue('<tag attr="attrval">nodeval</tag>', '//tag/@attr');
+------------------------------------------------------------------+
| ExtractValue('<tag attr="attrval">nodeval</tag>', '//tag/@attr') |
+------------------------------------------------------------------+
| attrval |
+------------------------------------------------------------------+
1 row in set (0.00 sec)
Note that XPath considers an attribute to be a child of the element to which it belongs.
Also note that the result in this example is actually a nodeset.
cheers
jon.
Jon Stephens
MySQL Documentation Team @ Oracle
MySQL Dev Zone
MySQL Server Documentation
Oracle
Subject
Written By
Posted
September 09, 2012 02:38AM
Re: How to select an XML attribut with SQL
September 10, 2012 03:06AM
September 11, 2012 08:11AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.