I have an XML document that is structured like:
<?xml version="1.0" encoding="UTF-8"?><Agregat xmlns:DGE="urn:ops:rncps:dge" xmlns:SNGI="urn:cnav:sngi">
<DGE:Entete PGMD_Profil="SORTIEDGE" Profil_Version="01.02">
<DGE:Identification>195a3415-94de-45d3-a4a4-144055c7e2bb</DGE:Identification>
<DGE:Temps>2016-06-02T14:49:31.401+02:00</DGE:Temps>
<DGE:RefService>M0004E001</DGE:RefService>
<DGE:VersionService>01.01</DGE:VersionService>
<DGE:NbDoc>23</DGE:NbDoc>
<DGE:Emetteur>
<DGE:Identite R="RFO">99640000</DGE:Identite>
<DGE:Qualite>OPDGE</DGE:Qualite>
</DGE:Emetteur>
<DGE:Recepteur>
<DGE:Identite R="RFO">00171002</DGE:Identite>
<DGE:Qualite>CONSDGE</DGE:Qualite>
</DGE:Recepteur>
</DGE:Entete>
</Agregat>
I would like to select the value of the element "DGE:NbDoc" which is 23.
The SQL query that I produced is:
SELECT RPAD(extractValue(Entete.column_value, '//NbDoc'),2,' ') AS NbDoc
FROM COMMUN.SESSION_TEMP_XML s
,TABLE( XMLSequence( extract( s.xml_data
,'//Agregat//Entete','xmlns:DGE="urn:ops:rncps:dge"') ) ) Entete
How can I select the value of NbDoc Element?
//*[local-name()='Agregat']/DGE:NbDoc/.Not sure if it will work in oracle xpath, you can try.//*[local-name()='Agregat']/DGE:Entete/DGE:NbDoc/text()