I am trying to parse XML Node values from CLOB field and it is throwing invalid Token Error: XML:
create table traptabclob(testclob clob);
insert into traptabclob values('<?xml version="1.0" encoding="UTF-8"?>
<tns:InputOutputScoringDetails xmlns:tns="jdhajdjh" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="dasd.xsd ">
<tns:InputsOutputs>
<tns:NameValue>
<tns:Name>ABSC_APPLICANTBUREAUSCORE</tns:Name>
<tns:Value>0.11030000000000001</tns:Value>
</tns:NameValue>
<tns:NameValue>
<tns:Name>ABS_BN_SCORE_DETAIL_PK</tns:Name>
<tns:Value>10035</tns:Value>
</tns:NameValue>
</tns:InputsOutputs>
</tns:InputOutputScoringDetails>
');
SQL Query:
SELECT EXTRACTVALUE(xmltype(testclob), '/tns:InputOutputScoringDetails/tns:InputsOutputs/tns:NameValue[1]/tns:Name')
FROM traptabclob;
Can anyone help me as how can I use xmltype and extractvalue to extract values for Name or Value nodes?
thanks
tns;is an xml namespace. You need to tell extract value about the namespaces, by passing a third argument giving the space-separated list of thexmlnsvalues. So, the third argument would be'xmlns:tns="jdhajdjh"'.