MySQL Forums
Forum List  »  Connector/Node.js

Re: How to select an XML attribut with SQL
Posted by: Jonathan Stephens
Date: September 10, 2012 03:06AM

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

Options: ReplyQuote


Subject
Written By
Posted
Re: How to select an XML attribut with SQL
September 10, 2012 03:06AM


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.