× 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.



XML is just a hierarchical data structure totally similar to JSON – just in
another format. The good about java/javascript is that these languages has
native instructions to process these hierarchical objects, RPGLE has
neither support for hierarchical objects nor instructions to process them
unless you predefine their structures in hierarchical data structures
(XML-INTO).



However I have written both XML node support for creation XML and an XML
reader in RPGLE but both has a procedural approach that many XML JAVA and C
plugins also uses.



In case of you want to update, remove or insert anything in an XML object
with this approach you have to rewrite the entire XML object into a new and
then replace the old with the new and that is actually rather easy.



But XML has never originally been intended for frequently updates, it is an
intermediate data format between systems, so there is very seldom the need
to update part of an XML document.



That some today also uses XML to store properties is another thing, but
here we are in a very technical special area of programming that is very
seldom programmed in RPGLE and if it is, it will just receive a complete
new updated XML object back from the client.



The same must go for WEB FORMS where the browser either sends in a POST
with form fields or sends in an XML document – in first case recreate the
XML and store it, in second case just store the XML document.


On Sun, Dec 23, 2012 at 7:12 PM, Richard Schoen <richard@xxxxxxxxxxxxxxx>wrote:

That DB2 update will be nice for customers who need to store raw XML such
as ours do.

However will it be available in V7R1+ or back ported to V5R4 and V6R1 ?
We still see lots of customers on those releases.

SQL Server already supports an XML type. Not sure about MySQL.

Our web forms product stores its documents in XML format so the need will
become increasingly important to transparently process databases stored XML
from the i for our customers and others I would imagine.

You're correct that Java is pretty much re-writing the XML file, but it
sure feels bodaciously easy (if that's a word) :-)

Regards,
Richard Schoen
RJS Software Systems Inc.
Where Information Meets Innovation
Document Management, Workflow, Report Delivery, Forms and Business
Intelligence
Email: richard@xxxxxxxxxxxxxxx
Web Site: http://www.rjssoftware.com
Tel: (952) 736-5800
Fax: (952) 736-5801
Toll Free: (888) RJSSOFT

------------------------------

message: 5
date: Sun, 23 Dec 2012 11:57:03 -0600
from: Joe Pluta <lists@xxxxxxxxxxxxxxxxx>
subject: Re: Updating XML File from an RPG App

On 12/21/2012 11:14 AM, Richard Schoen wrote:
I found a Java example and it took about 30 minutes to put together a
general Java program to accomplish this.

I wrapped it with a CL program and Viola it's done.

Hate to say it but for complex things like XML, Java is much more
efficient.

Two things. First, XML isn't complex. The problem is the implementation.
It's a stream file, something that RPG has never been strong dealing with.
We've gotten MUCH better over the years with varying fields and a number
of other great capabilities, but still it's not RPG's strong suit. I don't
care is it's CSV, PNG or XML, RPG isn't optimal for stream files. That
being said, you can do a whole HECK of a lot with the XML support in RPG;
combine XML-INTO and CGIDEV2 and RPG is a very powerful XML processing
environment. Whether to use it depends on how much back end RPG you need
to do.

Second, the problem is the implementation :). When you say "update" you
don't really mean update. To update an XML file, you literally rewrite the
stream file. Java may hide the complexity, but you're still rewriting the
stream. You don't just insert (or delete) a few bytes in the middle of the
file. You can do the same thing in RPG relatively easily, but it's not as
straightforward as the wrappers that Java provides. As usual in RPG you
have to do a lot of the heavy lifting yourself.

But that's all going to change. You might want to check into DB2 9, which
is currently only available for DB2 LUW but hopefully is coming soon to an
IBM i near you (and me!). DB2 9 uses pureXML which in my opinion will
pretty much do away with most of the XML processing we do today.

You can directly query an XML document much like you would a normal
relational table and you can combine relational and XML access, updating
one from the other, all at a high level and without having to shred the XML
document yourself.

It's most bodacious.

Joe



--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





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.