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

Re: XML Writer Service program



   Hi Henrik, It looks like i Want, I'll see if I can download and
   install CGIDEV2.
   But the  idea is justa that,
    having a stack of tags, to allow me to only cal a procedure
   "CloseXmlTag()"
   Best Regards.
   Nicolas
   [1]hr@xxxxxxxxxxxx escribió:

   Hi,
   enclosed is a service program that does the trick;
   Sample code
   --------------------------------------------------------
   clrSrvPgm();
   // setGlobalTab(*off);   // compress the file
   // setGlonalNL(*off);    // by omitting Tab's and CRLF
   // if you wish to send it out over HTTP
   setContent('text/xml');
   echo('# This is a generated xml-file');
   echo('');
   xmlNode('xml');
     xmlNode('header':'custNumber='+%char(cust));
       xmlNode('name':'':cuname);                   // "Jon & Susan"
       xmlNode('adress':'':cuadrs);
       select;
         when country = 'dk';
           xmlNode('zip':'list=dk':%char(cuzip));
         when country = 'usa';
           xmlNode('zip':'list=us':%char(cuzip));
       endsl;
     xmlEndNode();
   xmlEndNode();
   select;
     when output = 'file';               // Output to File
       echoToStmf('/testxml.xml':1208);    // most XML converters likes
   UTF-8
     when output = 'http';               // Output to HTTP buffer
       echoFini();
   endsl;
   Result:
   ---------------------------------------------------------
   Content-type: text/xml
   # This is a generated xml-file
   <xml>
           <header custNumber=123456>
                   <name>Jon &#38; Susan</name>
                   <adress>Stampedammen</adress>
                   <zip list=dk>1234</zip>
           </header>
   </xml>
   This code is done by a CGIDEV2 service extension program that
   handles not only the single node's but also the tree, so there
   is no need to insert tabs or to remember parent nodes when
   ending them with xmlEndNode() and it eliminates spelling
   errors between start and end nodes.
   It also automatically handles the special character incoding
   of strings in the XML.
   And there is no need for CGIDEV2 templates wich does it far
   easier to include/exclude elements by just using inline tests.
   Note:
   The enclosed basic service program is part of a larger WEB 2.0
   (ext JS) project that will be released later this year and it
   is build on top of a modified CGIDEV2 (Scott's CCSID support
   modification for Unicode CCSID).
   Regards
   Henrik

   Nicolas Machado [2]<nicolas.machado@xxxxxxxxxxxxx>
   Sent by: [3]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx

   06-07-2009 16:34

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

                                                                       To

   HTTPAPI and FTPAPI Projects [5]<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       cc

                                                                  Subject

   XML Writer Service program

   Hi,
   I'm starting a project that need to write xml files.
   I know that there is no mora "rocket science" that wrinting to a
   stream
   file in teh IFS.
   But I'm wondering is someone has developed something like:
     xml =  pCreateXmlObject();
      pWriteStartElement(xml : 'Invoice') ;
      pWriteTag(xml : 'InvNro' : $InvoiceNumber ) ;
      pWriteEndElement(xml)
   To for example create this xml
      <Invoice>
            <InvNr>some value</InvNr>
      </Invoice>
   If anyone has something , please let me know.
   --
   .::.
   Nicolas Machado
   Metodo Argentina S.A.
   _____________________
   Tel: 02262 527431
   Necochea, Buenos Aires.
   ----------------------------------------------------------------------
   -
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [6]http://www.scottklement.com/mailman/listinfo/ftpapi
   ----------------------------------------------------------------------
   -

    _______________________________________________________________________

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
[7]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

--
.::.
Nicolas Machado
Metodo Argentina S.A.
_____________________
Tel: 02262 527431
Necochea, Buenos Aires.

References

   1. mailto:hr@xxxxxxxxxxxx
   2. mailto:nicolas.machado@xxxxxxxxxxxxx
   3. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   4. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   5. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   6. http://www.scottklement.com/mailman/listinfo/ftpapi
   7. 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
-----------------------------------------------------------------------