i am trying to use XPath to extract data from XML Field in Oracle. So basically, when i am trying to Extract the SessionID from the XML Filed using XPath expression - //SessionID , i get null. To get the desired output i have to do something like /* / *[1] /text(), which is not very good, cuz if the structure changes, it will not work. I have realized that there is a problem with xmlns attribute, and that is why it wil not work as intended. Anyone can help me with this? On how to delete xmlns attribute, or bypass it somehow.
Here is the expression that i am using to get the proper answer.
select EXTRACT(XMLTYPE('<Session xmlns="http://www.tibco.com" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SessionID>ASDASDASD</SessionID></Session>'),'/*/*[1]/text()')
from dual;
I have tried using Deletexml, but it will not work with xmlns (it works with other attributes, but not xmlns), so i guess that is not he solution.
Thanks in advance for the help.