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!

Help asked with specific xmltable function functionality...

rhollakFeb 8 2018 — edited Feb 9 2018

I have searched various site and xquery examples now, but I have following issue:

In a piece of SQL code I need to extract an xmltype from a namespaced XML document.
However in he resulting xmltype element from the XMLTABLE function, the namespace of the document is also returned .
To clarify this example, tested on Oracle 12c:

select id, name, rec_content
  from xmltable
       ( xmlnamespaces(default 'x:www.xxx.org')
       ,'/doc'
       passing xmltype('<doc xmlns="x:www.xxx.org"><id>12345</id><name>Test</name><rec><c1>Value-C1</c1><c2>Value-C2</c2></rec></doc>')
               columns id          varchar2(35)  path 'id'
                     , name        varchar2(35)  path 'name'
                     , rec_content xmltype       path 'rec'
             ) sched;

Following is the result from the rec_content (xmltype) column...

<rec xmlns="x:www.xxx.org">

c1>Value-C1</c1>

c2>Value-C2</c2>

</rec>

So as you can see.. The Original namespace, from the doc is replicated in the "output" of the xmltype of rec_content.

Is there a way to avoid the namespace to appear in the result and make the xmltype result namespace-less?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2018
Added on Feb 8 2018
2 comments
690 views