× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Brian

I've been using CGIDEV2 - it's a free utility - you might also look at powerEXT, which takes a slightly different approach - also free.

There was a recent thread on this - either one is good, I think - CGIDEV2 uses a template that has the main XML structure, along with markers that identify sections (like record formats in a DSPF) and variables (like fields in a DSPF).

powerEXT uses procedures that are more based on XML nodes - so you write out the data in a manner that may more closely align with the XML structure, at least in the code.

Results can be identical, of course.

In that thread, Henrik posted the link to the recent modernization Redbook that discusses these 2 products, as well as a 3rd, XMLi - I've not tried the last one yet -

http://archive.midrange.com/midrange-l/201408/msg00614.html

Here are simple examples, based on a program I wrote here - first the CGIDEV2 version, then the powerEXT version - the RPG code is really clean in either case -

The template for CGIDEV2 is here, then the code -

<!-- $FileHeader$ -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE activity_import_file SYSTEM "activity.dtd">
<activity_import_file>
<!-- $Activity$ -->
<activity>
<custno><!-- %CustomerNumber% --></custno>
<actvdate><!-- %ActivationDate% --></actvdate>
<actvtime><!-- %ActivationTime% --></actvtime>
<history><![CDATA[<!-- %HistoryEntry% -->]]></history>
</activity>
<!-- $FileFooter$ -->
</activity_import_file>

And now the code -

/free
IfsMultIndicators = getHtmlIfsMult('/XML/activities.tpl' :
'<!-- $' : '$ -->' : '<!-- %' : '% -->');

ClrHtmlBuffer();

wrtSection('FileHeader');

updHtmlVar('CustomerNumber' : custno);
updHtmlVar('ActivationDate' : %char(actdate));
updHtmlVar('ActivationTime' : %char(acttime));
updHtmlVar('HistoryEntry' : history);

wrtSection('Activity');

wrtSection('FileFooter');

rc = wrtHtmlToStmf('report.xml' : 1208);

*inlr = *on;
/end-free



On 8/13/2014 11:07 AM, Henrik Rützou wrote:

Debbie

It may be easier for you to make XML with inline code/subprocedures like
used in powerEXT Core,
to make Vernons example here is the complete code (Vernon is missing the
RPG part:

/free
clearSrvPgm();
setContent('*none');

echo('<?xml version="1.0" encoding="UTF-8"?>');
echo('<!DOCTYPE activity_import_file SYSTEM "activity.dtd">');

xmlNode('activity_import_file');

xmlNode('activity');
xmlNode('custno':'':%char(custno);
xmlNode('actvdate':'':%char(actdate);
xmlNode('actvtime':'':%char(acttime);
xmlNode('history':'':histdata);
xmlEndNode(); // ends activity

xmlEndNode(); // ends activity_import_file

echoToStmf('/testfile.xml':1208);
*inlr = *on;
/end-Free

On 8/19/2014 2:56 PM, Brian Stapleton wrote:
Good Afternoon

I need to learn how to write XML documents with RPGLE V7R1M0 onto our IFS.

How can I educate myself on doing this?

I would prefer to stay as native RPGLE as possible, and am not looking to purchase a 3rd party solution.





Brian Stapleton
Information Services
Carhartt, Inc
5750 Mercury Drive
Dearborn, MI 48126
Desk - 313-749-6586
Fax - 313-271-3455
BStapleton@xxxxxxxxxxxx<mailto:BStapleton@xxxxxxxxxxxx>

[Description: Description: Carhartt_emaillogo]


Confidential: This electronic message and all contents contain information from Carhartt, Inc. and its affiliates which may be confidential or otherwise protected from disclosure. The information is intended to be for the addressee only. If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify us immediately at (313) 271-8460 and destroy the original message and all copies.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.