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?