[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http_url_post and CGIDEV2



   Hi why don't you just make 3 simple subprocedures so you can
   declare XML in your program like this:
   xmlAddNode('aXmlHeader':'someAttributes');
     xmlAddChild('aTagName':'someAttributes':'someData');
     xmlAddChild('aTagName':'someAttributes':'someData');
     xmlAddChild('aTagName':'someAttributes':'someData');
   xmlEndNode('aXmlHeader');
   resulting in this well structured XML
   <aXmlHeader someAttributes>
         <aTagName someAttributes>someData</aTagName>
         <aTagName someAttributes>someData</aTagName>
         <aTagName someAttributes>someData</aTagName>
   </aXmlHeader>
   ohhh, it will write well structured HTML as well
   xmlAddNode('table');
   for i = 1 to 2;
     xmlAddNode('tr');
       xmlAddChild('td'::'abcdefg');
       xmlAddChild('td'
        :'width="92%"'
        :'hijklmn'
       );
       xmlAddChild('td'::'opqrstu');
       xmlAddChild('td'::'vwxyz');
     xmlEndNode('tr');
   endfor;
   xmlEndNode('table');
   <table>
         <tr>
               <td>abcdefg</td>
               <td width="92%">hijklmn</td>
               <td>opqrstu</td>
               <td>vwxyz</td>
         </tr>
         <tr>
               <td>abcdefg</td>
               <td width="92%">hijklmn</td>
               <td>opqrstu</td>
               <td>vwxyz</td>
         </tr>
   </table>
   xmlAddNode ...
   // insert tabs
   if tabs > 0;
     for i = 1 to tabs;
       gxml = gxml
        + x'05'
       ;
     endfor;
   endif;
   // xml node
   gxml = gxml
    + '<'
    + xmlTagName
   ;
   if attributes > '';
     gxml = gxml
      + ' '
      + xmlAttributes
     ;
   endif;
   gxml = gxml
    + '>'
    + x'15'
   ;
   // set tab counter
   tabs = tabs + 1;
   // CGIDEV2 Output Buffer Implementation
   wrtNoSection(%addr(gxml)+2:%len(gxml));
   gxml = '';
   xmlAddChild ...
   // insert tabs
   if tabs > 0;
     for i = 1 to tabs;
       gxml = gxml
        + x'05'
       ;
     endfor;
   endif;
   // xml child
   gxml = gxml
    + '<'
    + xmlTagName
   ;
   if attributes > '';
     gxml = gxml
      + ' '
      + xmlAttributes
     ;
   endif;
   gxml = gxml
    + '>'
    + xmlEncode(xmlData) // Encode Special xml Char (<> etc.')
    + '</'
    + xmlTagName
    + '>'
    + x'15'
   ;
   // CGIDEV2 Output Buffer Implementation
   wrtNoSection(%addr(gxml)+2:%len(gxml));
   gxml = '';
   xmlEndNode ...
   // set tab counter
   tabs = tabs - 1;
   // insert tabs
   if tabs > 0;
     for i = 1 to tabs;
       gxml = gxml
        + x'05'
       ;
     endfor;
   endif;
   // xml node
   gxml = gxml
    + '</'
    + xmlTagName
    + '>'
    + x'15'
   ;
   // CGIDEV2 Output Buffer Implementation
   wrtNoSection(%addr(gxml)+2:%len(gxml));
   gxml = '';
   Regards
   Henrik

   "Houghton, Steve" <Steve.Houghton@xxxxxxxxxxxx>
   Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx

   01-04-2009 13:25

                             Please respond to
        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       To

   "'ftpapi@xxxxxxxxxxxxxxxxxxxxxx'" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       cc

                                                                  Subject

   http_url_post and CGIDEV2

   Hi,
   Am currently using http_url_post to send an XML request to a bank for
   credit card payments.  Generating the XML string looks very messy
   using :
   gxml+= '<element 1>' + value1 + '</element1>';
   gxml+= '<element 2>' + value2 + '</element2>';
   etc..
   in the code.  Is there a way to use the CGIDEV2 updHtmlVar/wrtSection
   procedures to create the XML buffer and instead of using AppHtmlToStmf
   to write to the IFS, make gXml = to the HTML buffer?
   Hopefully this isn't too far away from the scope of the HTTPAPI
   mailing list!
   Steve
   **********************************************************************
   ***********
   This communication has been sent to you by Ansvar Insurance Company
   Ltd.  Reg. No. 661060 England.
   Registered Office: Beaufort House, Brunswick Road,
   Gloucester. GL1 1JZ.
   Member of: Association of British Insurers (ABI); Financial Ombudsman
   Service.  Authorised and Regulated by the Financial Services Authority
   (FSA).

   This communication is sent in confidence and is intended for addressee
   only and is subject to the relevant terms and conditions. Access to
   this email by anyone else is unauthorised. Please advise the sender of
   any error(s) in transmission of this communication.
   http://www.ansvar.co.uk
   **********************************************************************
   ***********
   ----------------------------------------------------------------------
   -
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   http://www.scottklement.com/mailman/listinfo/ftpapi
   ----------------------------------------------------------------------
   -
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------