3 Replies Latest reply: Mar 29, 2013 2:13 AM by odie_63 RSS

    Extracting data form XML by using XQuery and generating CSV file formate

    999234
      Hi all,

      I have created DB Adapter in Jdeveloper for selecting following output.
      After this i have imported that Adapter into Eclipse in OSB and generated Business service and created proxy service . in Proxy i was invoked this Businees service through ServiceCallout . after this i got the following output from Database. after that i have to extract data from the following output and need to generate CSV file formate.


      <soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
      <fet:FetchingGFS_P2P_StatusOutputCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fet="http://xmlns.oracle.com/pcbpel/adapter/db/FetchingGFS_P2P_Status">
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICE</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-27T10:58:45.499+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Interface Table Record Id: 9055</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>
      Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 362282
      </fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-27T10:58:45.499+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>34</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICE</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-27T10:58:45.592+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Interface Table Record Id: 9056</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>
      Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 364147
      </fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-27T10:58:45.592+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>35</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICEBATCH</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-27T10:58:45.939+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Concurrent Program Id: 593206</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>APXIIMPT</fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-27T10:58:45.939+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>36</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICE</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-27T12:02:28.679+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Interface Table Record Id: 9057</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>
      Source Invoice No: COM41281-0197, Source Vendor Site Code: BRITAX AUTOMOTI, Voucher Number: 362282
      </fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-27T12:02:28.679+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>37</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICE</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-27T12:02:28.711+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Interface Table Record Id: 9058</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>
      Source Invoice No: COM41281-0197, Source Vendor Site Code: BRITAX AUTOMOTI, Voucher Number: 364147
      </fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-27T12:02:28.711+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>38</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICEBATCH</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-27T12:02:28.814+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Concurrent Program Id: 593212</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>APXIIMPT</fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-27T12:02:28.814+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>39</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICEBATCH</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-26T20:16:03.78+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Concurrent Program Id: 593010</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>APXIIMPT</fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-26T20:16:03.78+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>33</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICE</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-26T20:16:03.6+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Interface Table Record Id: 9052</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>9052</fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-26T20:16:03.6+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>31</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      <fet:FetchingGFS_P2P_StatusOutput>
      <fet:SERVICE>SyncPayableInvoiceGIPStageReqABCSImpl</fet:SERVICE>
      <fet:OPERATION>SyncPayableInvoice</fet:OPERATION>
      <fet:TYPE>APINVOICE</fet:TYPE>
      <fet:STATUS_TIMESTAMP>2013-03-26T20:16:03.649+11:00</fet:STATUS_TIMESTAMP>
      <fet:STATUS_CODE>NEW</fet:STATUS_CODE>
      <fet:STATUS_MESSAGE>Interface Table Record Id: 9053</fet:STATUS_MESSAGE>
      <fet:STATUS>SUCCESS</fet:STATUS>
      <fet:BUSINESS_INFO>9053</fet:BUSINESS_INFO>
      <fet:BATCH_NAME>CaseWin_APInvoice_GFS_20130321.CSV</fet:BATCH_NAME>
      <fet:REPORTED_TO>GFS</fet:REPORTED_TO>
      <fet:REPORT_DATE>2013-03-26T20:16:03.649+11:00</fet:REPORT_DATE>
      <fet:SOURCE_SYSTEM>CASEWIN</fet:SOURCE_SYSTEM>
      <fet:TARGET_SYSTEM>GFS</fet:TARGET_SYSTEM>
      <fet:REC_ID>32</fet:REC_ID>
      </fet:FetchingGFS_P2P_StatusOutput>
      </fet:FetchingGFS_P2P_StatusOutputCollection>
      </soap-env:Body>


      The CSV file formate like below formate.
      SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T10:58:45.499+11:00,NEW,Interface Table Record Id: 9055,SUCCESS, Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 362282 ,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T10:58:45.499+11:00,CASEWIN,GFS,34
      and I need to loop for each fet:FetchingGFS_P2P_StatusOutput.

      Please help me on this how to write XQuery and How to generate CSV file.
      After this I need to send this CSV file to another service by invoking that service.
      Please do the needful ASAP.


      Thanks,
      Kiran.
      +91-9742672532.
        • 1. Re: Extracting data form XML by using XQuery and generating CSV file formate
          odie_63
          Assuming the input message is in a variable <tt>$body</tt> :
          declare namespace env = "http://schemas.xmlsoap.org/soap/envelope/";
          declare namespace fet = "http://xmlns.oracle.com/pcbpel/adapter/db/FetchingGFS_P2P_Status";
          
          string-join (
            for $row in $body/env:Body/fet:FetchingGFS_P2P_StatusOutputCollection/fet:FetchingGFS_P2P_StatusOutput
            return string-join($row/*/normalize-space(.), ",")
          , "&#38;#x0A;"
          )
          will produce a single string containing this :
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T10:58:45.499+11:00,NEW,Interface Table Record Id: 9055,SUCCESS,Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 362282,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T10:58:45.499+11:00,CASEWIN,GFS,34
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T10:58:45.592+11:00,NEW,Interface Table Record Id: 9056,SUCCESS,Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 364147,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T10:58:45.592+11:00,CASEWIN,GFS,35
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-27T10:58:45.939+11:00,NEW,Concurrent Program Id: 593206,SUCCESS,APXIIMPT,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T10:58:45.939+11:00,CASEWIN,GFS,36
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T12:02:28.679+11:00,NEW,Interface Table Record Id: 9057,SUCCESS,Source Invoice No: COM41281-0197, Source Vendor Site Code: BRITAX AUTOMOTI, Voucher Number: 362282,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T12:02:28.679+11:00,CASEWIN,GFS,37
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T12:02:28.711+11:00,NEW,Interface Table Record Id: 9058,SUCCESS,Source Invoice No: COM41281-0197, Source Vendor Site Code: BRITAX AUTOMOTI, Voucher Number: 364147,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T12:02:28.711+11:00,CASEWIN,GFS,38
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-27T12:02:28.814+11:00,NEW,Concurrent Program Id: 593212,SUCCESS,APXIIMPT,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-27T12:02:28.814+11:00,CASEWIN,GFS,39
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-26T20:16:03.78+11:00,NEW,Concurrent Program Id: 593010,SUCCESS,APXIIMPT,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-26T20:16:03.78+11:00,CASEWIN,GFS,33
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-26T20:16:03.6+11:00,NEW,Interface Table Record Id: 9052,SUCCESS,9052,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-26T20:16:03.6+11:00,CASEWIN,GFS,31
          SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-26T20:16:03.649+11:00,NEW,Interface Table Record Id: 9053,SUCCESS,9053,CaseWin_APInvoice_GFS_20130321.CSV,GFS,2013-03-26T20:16:03.649+11:00,CASEWIN,GFS,32
          • 2. Re: Extracting data form XML by using XQuery and generating CSV file formate
            999234
            Thanks for u help.

            But i was tried with u r xquery. i am unable to get the data . that xquery showing some errors.
            i have developed following xquery.
            i got the csv format o/p with header following xquery .

            <fet:FetchingGFS_P2P_StatusOutput>
            {
            let $nl := "&#10;"
            let $hdr := 'SERVICE,OPERATION,TYPE,STATUS_TIMESTAMP,STATUS_CODE,STATUS_MESSAGE,STATUS,BUSINESS_INFO,REPORTED_TO,REPORT_DATE,SOURCE_SYSTEM,TARGET_SYSTEM,REC_ID'
            return (($hdr),$nl)
            }
            {
            let $nl := "&#10;"
            for $line in $OutputStatusDb/fet:FetchingGFS_P2P_StatusOutput
            return
            concat(data($line/fet:SERVICE),',',
            data($line/fet:OPERATION),',',
            data($line/fet:TYPE),',',
            data($line/fet:STATUS_TIMESTAMP),',',
            data($line/fet:STATUS_CODE),',',
            data($line/fet:STATUS_MESSAGE),',',
            data($line/fet:STATUS),',','"',
            data($line/fet:BUSINESS_INFO),'"',',',
            data($line/fet:REPORTED_TO),',',
            data($line/fet:REPORT_DATE),',',
            data($line/fet:SOURCE_SYSTEM),',',
            data($line/fet:TARGET_SYSTEM),',',
            data($line/fet:REC_ID),$nl)
            }
            </fet:FetchingGFS_P2P_StatusOutput>

            the o/p is lioke below

            SERVICE,OPERATION,TYPE,STATUS_TIMESTAMP,STATUS_CODE,STATUS_MESSAGE,STATUS,BUSINESS_INFO,REPORTED_TO,REPORT_DATE,SOURCE_SYSTEM,TARGET_SYSTEM,REC_ID
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T10:58:45.499+11:00,NEW,Interface Table Record Id: 9055,SUCCESS,"Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 362282",GFS,2013-03-27T10:58:45.499+11:00,CASEWIN,GFS,34
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T10:58:45.592+11:00,NEW,Interface Table Record Id: 9056,SUCCESS,"Source Invoice No: COM41281-0197, Source Vendor Site Code: 16021, Voucher Number: 364147",GFS,2013-03-27T10:58:45.592+11:00,CASEWIN,GFS,35
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-27T10:58:45.939+11:00,NEW,Concurrent Program Id: 593206,SUCCESS,"APXIIMPT",GFS,2013-03-27T10:58:45.939+11:00,CASEWIN,GFS,36
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T12:02:28.679+11:00,NEW,Interface Table Record Id: 9057,SUCCESS,"Source Invoice No: COM41281-0197, Source Vendor Site Code: BRITAX AUTOMOTI, Voucher Number: 362282",GFS,2013-03-27T12:02:28.679+11:00,CASEWIN,GFS,37
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T12:02:28.711+11:00,NEW,Interface Table Record Id: 9058,SUCCESS,"Source Invoice No: COM41281-0197, Source Vendor Site Code: BRITAX AUTOMOTI, Voucher Number: 364147",GFS,2013-03-27T12:02:28.711+11:00,CASEWIN,GFS,38
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-27T12:02:28.814+11:00,NEW,Concurrent Program Id: 593212,SUCCESS,"APXIIMPT",GFS,2013-03-27T12:02:28.814+11:00,CASEWIN,GFS,39
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T18:55:13.084+11:00,NEW,Interface Table Record Id: 9061,SUCCESS,"Source Invoice No: COM41281-0111, Source Vendor Site Code: SYDNEY, Voucher Number: 362282",GFS,2013-03-27T18:55:13.084+11:00,CASEWIN,GFS,40
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-27T18:55:13.129+11:00,NEW,Interface Table Record Id: 9062,SUCCESS,"Source Invoice No: COM41281-0112, Source Vendor Site Code: SYDNEY, Voucher Number: 364147",GFS,2013-03-27T18:55:13.129+11:00,CASEWIN,GFS,41
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-27T18:55:13.217+11:00,NEW,Concurrent Program Id: 593352,SUCCESS,"APXIIMPT",GFS,2013-03-27T18:55:13.217+11:00,CASEWIN,GFS,42
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICEBATCH,2013-03-26T20:16:03.78+11:00,NEW,Concurrent Program Id: 593010,SUCCESS,"APXIIMPT",GFS,2013-03-26T20:16:03.78+11:00,CASEWIN,GFS,33
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-26T20:16:03.6+11:00,NEW,Interface Table Record Id: 9052,SUCCESS,"9052",GFS,2013-03-26T20:16:03.6+11:00,CASEWIN,GFS,31
            SyncPayableInvoiceGIPStageReqABCSImpl,SyncPayableInvoice,APINVOICE,2013-03-26T20:16:03.649+11:00,NEW,Interface Table Record Id: 9053,SUCCESS,"9053",GFS,2013-03-26T20:16:03.649+11:00,CASEWIN,GFS,32

            Could u please suggest on it how to write this with u r xquery?

            thanks,
            kiran.
            • 3. Re: Extracting data form XML by using XQuery and generating CSV file formate
              odie_63
              But i was tried with u r xquery. i am unable to get the data . that xquery showing some errors.
              What errors?

              i have developed following xquery.
              i got the csv format o/p with header following xquery .
              OK. What's wrong with your attempt?
              Do you want the header columns to be taken from the input XML instead of being hardcoded?

              In my example, I also used "normalize-space" function so that insignificant whitespaces are removed and don't pollute the output format.