XML parsing is not the case for < xmlns >!

People,

I try to analyse a XML data using XMLTABLE and because of the presence XML namespace attribute, it does not analyze the content. That's why no results.

If I change this to another name, it is able to retrieve the xml data. What can be done to analyze with < xmlns > suggestions?

Examples of data

-Table

create table xml_table (id number, xmlc xmltype);

-block insert xml data (sample)

declare

xmltype x_xml;

Start

delete from xml_table;

x_xml: = xmltype (' <? xml version = "1.0" encoding = "UTF - 8" standalone = "yes"? >)

"< ContactDetailsResponse xmlns="http://capabilities.nat.xyz.com/xsd/crm/v8/contactDetails"> ".

< Items >

< CUGID > CUG5000144600 < / CUGID >

< / Items >

< CustomerContact >

< ListOfEmailAddresses >

< EmailAddress >

Y < primary > < / elementary school >

Email from < type > < / Type >

< lastUpdated > 2015-03-24T 06: 06:39.000Z < / lastUpdated >

< MailAddress > [email protected] < / MailAddress >

< IntegrationId > NC1427177191 < / IntegrationId >

< ListOfEmailconsentPermission >

< EmailconsentPermission >

< type > consent to email < / Type >

< addressId > ABC. [email protected] < / addressId >

< value > No. < / value >

< confirmedDate > 2014-04-22 + 01:00 < / confirmedDate >

820ZCAV190 < accountId > < / accountId >

< / EmailconsentPermission >

< / ListOfEmailconsentPermission >

< / EmailAddress >

< EmailAddress >

Email from < type > < / Type >

< lastUpdated > 2013 - 10 - 04T 07: 51:55.000 + 01:00 < / lastUpdated >

< MailAddress > [email protected] < / MailAddress >

< IntegrationId > 921ECAV190 < / IntegrationId >

< ListOfEmailconsentPermission >

< EmailconsentPermission >

< type > consent to email < / Type >

< addressId > [email protected] < / addressId >

< value > No. < / value >

< confirmedDate > 2013-10-04 + 01:00 < / confirmedDate >

820ZCAV190 < accountId > < / accountId >

< / EmailconsentPermission >

< / ListOfEmailconsentPermission >

< / EmailAddress >

< / ListOfEmailAddresses >

< impairmentDetails >

< impairmentFlag > N < / impairmentFlag >

< / impairmentDetails >

< createdBy > 920321698 < / createdBy >

< createdOn > 2013 - 10 - 04T 07: 51:55.000 + 01:00 < / createdOn >

< lastModifiedBy > JUMI < / lastModifiedBy >

< lastModifiedOn > 2015-03-24T 06: 06:39.000Z < / lastModifiedOn >

< / CustomerContact >

(< / ContactDetailsResponse > ');

insert into

xml_table

values (1, x_xml);

commit;

end;

/

-The petition to analyze and extract

SELECT x1.prim,

x 1. ETYPE,

x1.EmailID,

x 2 .account_num,

x 2 .addr_id

OF xml_table x,.

XMLTABLE)

' / ContactDetailsResponse, CustomerContact, ListOfEmailAddresses, EmailAddress.

PASSAGE X.XMLC

COLUMNS prim VARCHAR2 (100) PATH '. / primary ',

ETYPE VARCHAR2 (100) PATH '. / Type',

EmailID VARCHAR2 (100) PATH "MailAddress".

child_xml PATH of XMLTYPE '.') x 1,

XMLTABLE)

"/ EmailAddress/ListOfEmailconsentPermission/EmailconsentPermission.

PASSAGE x1.child_xml

COLUMNS account_num VARCHAR2 (100) PATH "accountId"

addr_id VARCHAR2 (100) PATH 'addressId') x 2

WHERE prim = 'Y ';

-The result

ETYPE PRIM EMAILID ACCOUNT_NUM ADDR_ID

---------------------------------------

Y Email [email protected] 820ZCAV190 ABC. [email protected]

Let me know for any trouble again!

Thank you!

Post edited by: Ashu_Neo modified the e-mail ID and exit.

Specify namespace in XMLTABLE as below (untested)

SELECT x1.prim,

x 1. ETYPE,

x1.EmailID,

x 2 .account_num,

x 2 .addr_id

OF xml_table x,.

XMLTABLE (XMLNamespaces (default 'http://capabilities.nat.xyz.com/xsd/crm/v8/contactDetails'),

' / ContactDetailsResponse, CustomerContact, ListOfEmailAddresses, EmailAddress.

PASSAGE X.XMLC

COLUMNS prim VARCHAR2 (100) PATH '. / primary ',

ETYPE VARCHAR2 (100) PATH '. / Type',

EmailID VARCHAR2 (100) PATH "MailAddress".

child_xml PATH of XMLTYPE '.') x 1,

XMLTABLE (XMLNamespaces (default 'http://capabilities.nat.xyz.com/xsd/crm/v8/contactDetails'),

"/ EmailAddress/ListOfEmailconsentPermission/EmailconsentPermission.

PASSAGE x1.child_xml

COLUMNS account_num VARCHAR2 (100) PATH "accountId"

addr_id VARCHAR2 (100) PATH 'addressId') x 2

WHERE prim = 'Y ';

Thank you

Ann

Tags: Database

Similar Questions

Maybe you are looking for