When trying to get a value from an CLOB XML column, I get the following error:
ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: '/l-analysis/vehicle/odometer-reading/reading value/text()' 31011. 00000 - "XML parsing failed" *Cause: XML parser returned an error while trying to parse the document. *Action: Check if the document to be parsed is valid.
I have the following XML output:
<?xml version="1.0" encoding="UTF-8"?> <l-analysis> <vehicle> <make>SAAB</make> <model>9000 CSI</model> <body-style code="SL">Saloon</body-style> <vehicle-type code="7">Passenger car/van</vehicle-type> <odometer-reading latest="true"> <reading value="154267213">154267213</reading> <reading-date value="2006-07-17">17-Jul-2006</reading-date> </odometer-reading> </vehicle> </l-analysis>
When trying to get the reading value value, I am running this query:
select XMLTYPE(xml_data).EXTRACT('/l-analysis/vehicle/odometer-reading/reading value/text()').getStringVal() AS XML FROM lm
I believe the error is due reading value having spaces? 'Cause for another XML column that doesn't have spaces it works.
How could I get this working?
#xml #oracle