Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: extracting xml tag name

Re: extracting xml tag name

From: Stephane Faroult <sfaroult_at_roughsea.com>
Date: Mon, 05 Dec 2005 11:26:23 +0100
Message-Id: <1133778383.5262.39.camel@frlinux2.roughsea.com>


I am not very familiar with the XML stuff, but some old-fashioned string functions applied to your "xml" column can do it easily:

SQL> select substr(xml, 2, instr(xml, '>') - 2) tag   2 from (select '<blah>anyything here </blah>' xml   3* from dual)
SQL> / TAG



blah

HTH S Faroult

On Mon, 2005-12-05 at 12:07 +0200, Shay Toder wrote:
> hi,
>
> how can i get the NAME of the XML node,
> example -
> SELECT EXTRACT (VALUE (e), '/').getstringval () as xml
> , EXTRACTVALUE (VALUE (e), '/') as VALUE
> --, ??? as tag
> FROM TABLE (XMLSEQUENCE (EXTRACT (
> XMLTYPE ('<A>
> <B>2</B>
> <C>3</C>
> <D>4</D>
> </A>'
> ), '/A/*'))) e
>
> the result should be - (the first & second are ok, but how to get the
> third ?) -
>
> xml
> ---
> <B>2</B>
> <C>3</C>
> <D>4</D>
>
> value
> -----
> 2
> 3
> 4
>
> tag
> ---
> B
> C
> D
>
> Thanks,
> Shay
> --
> http://www.freelists.org/webpage/oracle-l
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Dec 05 2005 - 04:24:48 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US