Re: extracting xml tag name

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


Other related posts: