Well, what I loose with ONLY using XML-INTO is the flexibility to add
parameters <tags> to my XML, and using the values.
Meaning, if I wanted to add a new parameter<tag> to my XML, then I would
have to add new RPG code to handle the new parameter,
Whether it's adding a new DS variable, and/or adding a new XML-INTO
statement for the new parm<tag>.
The way I have it defined allows me to never worry about changing the RPG.
The existing code will know how to handle
all params<tags> passed in and react on it.
My main purpose was to try and remove as much hard-coded code as possible
and allow the program to flow
and have as little changes as possible.
David
David L. Mosley, Jr.
Technical Solutions Architect
Dancik International, Ltd.
2000 CentreGreen Way, Suite 250
Cary, NC 27513
www.dancik.com
Barbara Morris <bmorris@xxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
12/29/2009 05:30 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
To
rpg400-l@xxxxxxxxxxxx
cc
Subject
Re: XML-SAX Event-Handler loop.
dmosley@xxxxxxxxxx wrote:
...
So, what I did instead was for every "*XML_START_ELEMENT" event, I would
take the <tag> name
and execute an XML-INTO to get the tag's value.
So, in that sense, avoiding all other events, just made sense.
It's doing what I want it to do, I was just hoping to make it a bit more
efficient.
David, it's not going to be at all efficient if you are using XML-INTO
to reparse the XML document every time your XML-SAX finds a new element.
Rather than having the one XML-SAX loop, you have your XML-SAX loop
plus a number of hidden XML-INTO loops.
XML-INTO has to parse the XML document starting at the beginning to find
the bit that it's interested in. XML-INTO does stop when it has found
what it's looking for but on average you will be parsing half the
document for each XML-INTO that looks for the value of a specific tag.
I have to repeat Scott's question: Why not just use XML-INTO for the
entire XML document? Then you will only parse the XML document once and
when XML-INTO is done, you will have all the information you need.
As an Amazon Associate we earn from qualifying purchases.