| Extract Attribute Values? [message #344804] |
Mon, 01 September 2008 05:19  |
|
|
While executing the below query i get the output as
"B = "12""
SELECT
extractvalue(value(x) ,'/C')
FROM
TABLE(XMLSequence(extract(xmltype
('<A>
<C> B = "12" </C>
</A>'),'/A/C')))x
But my actual requirement is to retireve the value "12"
How to achieve it,
I tried out the below query but its not working,
SELECT
extractvalue(value(x) ,'/C/@b')
FROM
TABLE(XMLSequence(extract(xmltype
('<A>
<C> B = "12" </C>
</A>'),'/A/C')))x
|
|
|
|
|
|
| Re: Extract Attribute Values? [message #344837 is a reply to message #344804] |
Mon, 01 September 2008 06:17   |
|
|
Consider this below xml for eg,
<A>
<C> B = "12" D = "13"</C>
<C> B = "14" D = "15"</C>
</A>
Is there any method to project the above xml as below with out using substr or instr functions?
B D
12 13
14 15
|
|
|
|
| Re: Extract Attribute Values? [message #344846 is a reply to message #344837] |
Mon, 01 September 2008 07:02  |
 |
Michel Cadot
Messages: 54236 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
There is no XML function way as once you extract the values (those between <C> and </C>) it is no more XML.
So you have to use either substr/instr or regexp functions.
Regards
Michel
|
|
|
|