I'm trying to extract values from XML that is similar to below and is stored in an Oracle 10g table:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" ...">
<organizations>
<organization identifier="***"><item identifier="_745"><item identifier="_9700"><imsss:sequencing><imsss:scoreAndRollup isCompletionRolledUp="false" isMasteryRolledUp="false" isScoreRequired="true" scoreRollupWeight="1.0"/></organization>
</organizations>
<resources/>
</manifest>
The query I'm trying to use is:
select xmltype(t.xml).extract('/manifest/organizations/organization').getStringVal() from BLAxml t
The data type of the xml column in the underlying table is CLOB.
Unfortunately, every time I run this query it returns an empty string for the value rather than the contents of this portion of the XML statement. It doesn't seem to matter what portion of the XML I'm pointing to, it gives me an empty string.
Any help would be greatly appreciated. Thank you.
organizationnode and all its children. But by converting it to a string value, the result is an empty string because the tags don't have any content (there are no text nodes in any of the descendants). You might want to extract that in XPath and manipulate the nodes after your retrieve them in another language, or select data in individual attributes.XmlTypeso you could perform additionalextract()operations in the context of the result, and you can usegetStringVal()to retrieve the string contents of attributes.