The reason for the exercise I recommended is because it takes it out of an
unnatural/unnative form (i.e. XML) and puts it into a much more natural
one (i.e. DB2). Once XML data is in a more OS400/RPG/DB2 native format it
is much easier to work with IMO and would make it so no other programmer
in your shop would ever have to learn to parse XML.
The approach I conveyed is not without it's costs. There is a DB WRITE
for each piece of data whether you wanted to retain that data or not. For
some small XML documents this doesn't make much difference but for high
performance uses you wouldn't want to embrace the XML to DB2 generic
program IMO.
HTH,
Aaron Bartell
http://mowyourlawn.com
Sharon wrote:
Hi Aaron, thanks for your interest in my problem. I could do something like this, I did get a nifty little program from Jon Paris that would take a XML file and drop it into a spool file showing what each section of the file's element name was the the value of the chars inside it. Based on what I am facing here, the 'generic' program would be a massive checking of type of document I am working with (sales, returns, shipping etc.) and have to check the potential value of any element, which could have many different names going to many different field names in our files. This thing could me miles long.
I ran this past my IT guy who has worked with XML in other aspects and said one of the beauties of XML is you can be very specific in your naming of things to match what you need. His question was why to make something generic out of something that is supposed to be specific? Guess that is a debate for me and my supervisors.
Sharon
Date: Tue, 18 Nov 2008 05:55:47 -0600
From: aaronbartell@xxxxxxxxx
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Create a generic mapping function that will use XML-SAX
What I was suggesting is leaving any and all hard-coding outside of this
generic program so it could play the part of parsing all XML documents
it comes in contact with so no other programs on the system would have
to perform any XML parsing. I have written such a program for RPG-XML
Suite (www.rpg-xml.com) but that obviously doesn't help this situation
if you don't have that software package, though it wouldn't be that hard
to recreate with IBM's parser as they give you all the necessary parsing
events to accomplish the task.
I had to head over to wikipedia to learn about what a
finite-state-machine was :-) And I still don't completely follow you,
but that is fine as long as we can come to conclusions on the details
(maybe if I have some more coffee I will catch on :-).
Aaron Bartell
http://mowyourlawn.com
sjl wrote:
I wrote:
That sounds rather like a state machine...
then Aaron wrote:
Maybe you could expound on your comment
as I am not sure what you are getting at.
Aaron -
I was a little confused on what you wrote.
I was thinking along the line of instead of having the XML tag names
hard-coded in the program to storing them in a database file and let the
program process thru the tag names stored in the database file for parsing
the XML document, which I believe makes it similar to a
finite-state-machine.
Does that make sense?
- sjl
--
This is the RPG programming on the AS400 / iSeries (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.
_________________________________________________________________
Get more done, have more fun, and stay more connected with Windows Mobile(R).
http://clk.atdmt.com/MRT/go/119642556/direct/01/
As an Amazon Associate we earn from qualifying purchases.