0

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?

8
  • //*[local-name()='Agregat']/DGE:NbDoc/. Not sure if it will work in oracle xpath, you can try. Commented Jul 15, 2016 at 14:38
  • This Xpath doesn't compile. Commented Jul 15, 2016 at 14:45
  • please show the error that you were getting before Commented Jul 15, 2016 at 14:47
  • Thats the problem, i'm gettin empty result, no error. thx svasa for investigating! Commented Jul 15, 2016 at 14:56
  • sorry my previous xpath was missing entete, try : //*[local-name()='Agregat']/DGE:Entete/DGE:NbDoc/text() Commented Jul 15, 2016 at 14:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.