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: Shay Toder <shayt_at_fts-soft.com>
Date: Tue, 6 Dec 2005 08:57:00 +0200
Message-ID: <7FF923B77C9A3D46BD808F3BD91473ACF0CF44@ftsmail.fts-soft.com>


Thank you very much,
It works like a charm.

Another option is to use this line (if you exactly in the place, if not, your line is better) -   VALUE (e).getrootelement() AS tag2

Like in this example -
SELECT EXTRACT (VALUE (e), '/').getstringval () AS xml

     , EXTRACTVALUE (VALUE (e), '/') AS VALUE
     , XMLTYPE (EXTRACT (VALUE (e), '/').getstringval ()).getrootelement() AS tag
     , VALUE (e).getrootelement() AS tag2
  FROM TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(
     '<A>
        <B>2</B>
        <C>3</C>
        <D>4</D>
     </A>')
       , '/A/*'))) e

thanks,
Shay

 -----Original Message-----

From: 	Christian Antognini [mailto:Christian.Antognini_at_trivadis.com] 
Sent:	Monday, December 05, 2005 7:58 PM
To:	Shay Toder
Cc:	oracle-l_at_freelists.org
Subject:	RE: extracting xml tag name

Shay

>how can i get the NAME of the XML node,

In XPath the fuction name() should be used for that. Unfortunately you cannot use it with extract()...

Here a workaround:

SQL> SELECT XMLType(extract(value(e),'/').getstringval()).getRootElement() AS xml   2 FROM TABLE (XMLSEQUENCE (EXTRACT (

  3       XMLTYPE ('<A>
  4                    <B>2</B>
  5                    <C>3</C>
  6                    <D>4</D>
  7                </A>'
  8            ), '/A/*'))) e;

XML



B
C
D

HTH
Chris

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Dec 06 2005 - 01:00:43 CST

Original text of this message

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