On Wed, May 18, 2016 at 9:15 AM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:
Guess I'm guilty of repeating rumors. I've always heard XML-INTO isn't
the right choice for large complex documents.
I wouldn't call them "rumors" so much as personal choices. When OP
asked about XML handling a couple of weeks ago, he got a response from
Matt Tyler, who recommended XML-SAX rather than XML-INTO:
http://archive.midrange.com/rpg400-l/201605/msg00033.html
He was speaking from personal experience, not just parroting something he read.
I think there are *some* technical issues (I truly believe there is
some size or complexity at which XML-INTO just breaks down, though I
do not have personal experience of this). But I think a lot is just
preference and comfort level.
For example, Jon says there's a lot of "tedious" programming involved
with SAX. But I think for folks who prefer SAX-style processing, they
will likely build up a library of infrastructure code which eases some
of that tedium, or they find the SAX style so intuitive that they
don't mind or notice the tedium.
In the other direction, SAX fans often bring up how they hate the
complexity of the DS necessary for XML-INTO as the XML they are
parsing gets hairier. But Jon and Stephen are talking about
infrastructure (in the form of automated generation of D-specs), which
would take a lot of that pain and tedium away. (And it sounds like
some folks just find a lot of comfort or ease in building data
structures, and don't mind laying that groundwork even if they have to
do it manually.)
From where I'm sitting (as someone who hasn't done a whole lot of XML
processing, and none of it in RPG), it seems like both XML-SAX and
XML-INTO have potentially big hills to climb for folks just starting
out. It reminds me a lot of the discussions people have regarding IBM
system APIs. People who have already used them extensively find them
pretty easy to use. Most of these people have already built handy
RPG-friendly wrappers around any APIs they've used in the past, and
have enough wrappers under their belt that any additional ones they
have to write going forward are old hat. But for the API newbie, it
can be tricky and tedious to set them up.
Maybe if I were to use both XML-SAX and XML-INTO, I would develop a
preference for one or the other, or switch between them depending on
the kind of XML processing I want to do. To be perfectly honest, I
doubt I will get to that point, because I'll probably just pull out
Python instead.
Interesting comment about the new XML SQL stuff. Admittedly, I have't
tried it yet. Looking into it a little deeper, I can see where
"annotating" an existing schema could take some effort. Let alone building
one from scratch. It'd be nice if RDi's XML perspective offered some built
in support for this.
I know even less about the XML facilities in SQL (on any platform, not
just i) but I would have guessed that SQL has some intrinsic
advantages over RPG that would be useful for this task. In particular,
SQL is more dynamic, so I would expect it to cope with complexity and
variability more easily than RPG (especially XML-INTO). But I can't
stress enough that this is just my naive intuition.
John Y.
As an Amazon Associate we earn from qualifying purchases.