Skip to Main Content

Database Software

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!

Extracting xml node value with multiple namespace

2639076Jun 26 2014 — edited Jun 26 2014

Hi ,

I have to extract values from below xml which includes multiple namepspaces. only one namespace  has value for xmlns. I managed to get node value for event tag where as info tag returns null value.

experrts help needed.

<?xml version="1.0" encoding="utf-8"?>

<event xmlns='http://www.w3.org/2001/XMLSchema-instance' >

<data xmlns=''>

<object>

<eventtype>110</eventtype>

<result>RESULT</result>

</object></data>

<info xmlns=''><jref>JREF</jref>

</info>

</event>

SELECT

  TMX.eventtype,

  TMX.result,

  TMX.jref

from EXAMPLE_MESSAGES1,

     XMLTABLE(XMLNAMESPACES(DEFAULT  'http://www.w3.org/2001/XMLSchema-instance'),

'for $i in /event/data/object

return element local:r{$i/eventtype,

                       $i/result,

                       $i/jref}'

PASSING EXAMPLE_MESSAGES1.XML_MESSAGE

COLUMNS

  EVENTTYPE VARCHAR2(30) PATH 'eventtype',

  RESULT VARCHAR2(30) PATH 'result',

  JREF VARCHAR2(30) PATH 'jref') TMX;

Database version is 11.2.0.3.0

This post has been answered by odie_63 on Jun 26 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2014
Added on Jun 26 2014
2 comments
2,408 views