Hi Thorbjørn,

as I read the tread, it is more about processing XML rather than writing
XML. This without
using a java based reader.

You have native RPGLE/XML-INTO, you can use the C-based EXPAT that Scoot
uses or
you can use the build in RPGLE based xmlReader in powerEXT Core and there
may be
other free tools out there. But if your main language (BL) is RPGLE why try
to include
java classes into RPGLE, reading XML isn't rocket science and no java
classes is
to my best knowledge able to offer you inline RPGLE routines to manage stmf
in/outs,
HTTP in/outs, xml generation/reading/manipulation in one coherent class and
most
javaclasses will be OO-oriented where your BL will be procedural.

IMHO mixing OO and procedural programming in most cases dosn't make the best
of
two worlds, it just complicate things and OO programming isn't very suitable
in most IBM i
business apps where the main purpose is to convert hirachical (such as XML)
data back and
forth into datastructures such as headers, details and totals in RDBMS
databases.



What Jon overlooked in his article is that powerEXT Core is based on CGIDEV2
so it also has
template support as XMLi - just as a general support feature.

Also powerEXT Core has its own easy to use and flexible XML reader where you
do not have
to build datastructures as in RPGLE/XML-INTO to read elements in a
xml-structure.

Because powerEXT Core is build on top of CGIDEV2 you can migrate any CGIDEV2
program
to a powerEXT program by just replacing the CGIDEV2 library with the
powerEXT library
and recompile the program. If you then want to add eg. XML or JSON support
to an existing
CGIDEV2 program it is just to add this line to the program:

* powerEXT API Connectors
/copy qsrc,pxapicgicn Basic HTTP connecter & Productivity Services

powerEXT Core has 85 subprocedures making it more a "all in one" concept and
it also runs
with HTTPAPI thus covering both HTTP server and client programs and
online/batch programs.

Here is a little example of some of the XML functionality:

/free
// Clear Service Program & Responce Object
clearSrvPgm();
setContent('*none');

// Node Support (Jon's example)
xmlNode( 'root' );
xmlNode( 'Element1' : '' : elementValue1 );
xmlNode( 'Element2' : '' : elementValue2 );
xmlEndNode();

// Template Support (same result as Jon's example)

// <!--#tag="root"-->
// <root>
// <Element1><% parm1 %></Element1>
// <Element2><% parm2 %></Element2>
// </root>

setExtVar('parm1':encodeXML('element1data'));
setExtVar('parm2':encodeXML('element2data'));
echoAsp('/myxmltemplate.xml':'root');

// Output to stmf and/or http client
echoToStmf( '/Partner400/powerExtTest.xml': 1208 );
echoToClient();


// Read XML from buffer just created:
xmlReaderInz(bufAddr:bufSize);

// Read XML from HTTP Input:
xmlStore = getExtInputRaw();
xmlReaderInz(storeAddr(xmlStore):storeSize(xmlStore));
storeFree(xmlStore);

// Read the XML file into memory with xmlFromStmf method
xmlFromStmf('/Partner400/powerExtTest.xml');
xmlReaderInz(xmlAddr:xmlSize);

// Set Case of Element And Attribute Names
xmlReaderCase('L');

// Read the XML
dow xmlReader = 0;
select;

// Reading Data in Elements
when xmlGetNode = 'element1' and xmlGetAttr = '';
myElement1 = xmlGetData;
when xmlGetNode = 'element2' and xmlGetAttr = '';
myElement2 = xmlGetData;

// Saving a part of the XML document to a stmf
// (saves a single <root>...</root> section)
when xmlGetNode = '/root';
xmlToStmf('/rootset0001.xml':xmlOuterAddr():xmlOuterSize():1208);

endsl;
enddo;

// Free XML storage
xmlFree();

return;

On Wed, Jun 22, 2011 at 8:35 PM, Thorbjoern Ravn Andersen
<ravn@xxxxxxxxxx>wrote:

Den 22/06/11 19.09, Richard Schoen skrev:
I don't know why you wouldn't use Java.

The 32-Bit JVM smokes.

It still takes a serious effort to get up and running, but you got a
point. We only upgraded to 6.1 recently and I have not yet had time to
look at the J9 one.

What I am looking for is more things that work well when in an ILE
world, and not inside a JVM.

You are after all @runjva.com :-)
True. For some reason nobody else wanted it :)

--
Thorbjørn Ravn Andersen "...plus... Tubular Bells!"

--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.