Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

XML and multiple namespaces

user13117585Aug 31 2016 — edited Sep 15 2016

Hello,

I have a quick question about XMLType and how to extract values from it... I have one with many namespaces like this one:

WITH T AS (

   SELECT

'

   <project xmlns="http://www.test.com/xid/v2">

     <Node>NodeValue</Node>

     <Content>

       <Document:Document xmlns:Document="http://other.domain.be/prj/types/prj/file/1" xmlns="http://other.domain.be/prj/types/prj/file/1">

         <Details>

           <Id type="Local">123456</Id>

           <Id type="Remote">654321</Id>

         </Details>

       </Document:Document>

     </Content>

   </project>

' x

FROM dual 

SELECT ExtractValue(XMLType(x), '/project/Node', 'xmlns="http://www.test.com/xid/v2"'),

       ExtractValue(XMLType(x), '/project/Content/Document/Details/Id[@type="Local"]', 'xmlns="http://www.test.com/xid/v2"')

  FROM t;

And when I try to extract Local Id of a document, it always returns null. Any idea why? I'm using Oracle 11.2;

Thank you for your help.

This post has been answered by odie_63 on Sep 14 2016
Jump to Answer

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 13 2016
Added on Aug 31 2016
7 comments
4,667 views