I'm trying to extract values from XML that is coming back from a web service call. However, the inclusion of the "xmlns" attribute is causing my query to not work as expected.
This query works as expected, I get "Y" back:
SELECT EXTRACTVALUE(XMLType('<?xml version="1.0" encoding="utf-8"?><string><SAMP_OVERALL>Y</SAMP_OVERALL></string>')
,
'/string/SAMP_OVERALL') myval
from dual;
Here is the same query but the root tag "string" contains the xmlns attribute. This is how the actual XML comes back. I narrowed down it is the attribute giving me trouble. It returns null:
SELECT EXTRACTVALUE(XMLType('<?xml version="1.0" encoding="utf-8"?><string xmlns="someweburl"><SAMP_OVERALL>Y</SAMP_OVERALL></string>')
,
'/string/SAMP_OVERALL') myval
from dual;
Why does the inclusion of the xmlns attribute cause this not to return the value of the SAMP_OVERALL tag?
At this point I can't figure out the syntax to pull out the values that I need.
Thanks!