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

Re: XML Writer Service program



That looks _really_ interesting Nicolas.  I look forward to seeing  
what comes out of this.


Jon Paris

www.Partner400.com
www.SystemiDeveloper.com



On 7-Jul-09, at 10:24 AM, hr@xxxxxxxxxxxx wrote:

>
>   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 <nicolas.machado@xxxxxxxxxxxxx>
>   Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>
>   06-07-2009 16:34
>
>                             Please respond to
>        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
>
>                                                                       To
>
>   HTTPAPI and FTPAPI Projects <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:
>   http://www.scottklement.com/mailman/listinfo/ftpapi
>    
> ----------------------------------------------------------------------
>   -
> < 
> pxsrvcgi 
> .txt 
> > 
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------