|
On Thu, 7 Mar 2013, at 00:46:47, Joep Beckeringh <
joep.beckeringh@xxxxxxxxxx> wrote:
But I'm still not convinced: I don't see your point about a missingletter, what has that got to do with allow missing/allowextra? It would
just be bad data; a customer ID of 'on Paris' would certainly be rejected
by the check after the parsing. And a malformed numeric could cause an
exception when the target field was numeric; if I had defined the field
alpha, it would not pass the check either.
What I'm trying to point out is that your approach only deals with one
scenario:
It deals with this: <quantity></quantity> but not with this
<quantity>None</quantity> or <quantity>10CR</quantity>. So using numerics
in the DS always runs the risk of the parser failing completely. That's all
I'm trying to point out. If you are guaranteed that won't happen then fine.
But if I deal with quantity as alpha I can do the conversion with %Dec
wrapped in a MONITOR. Not only can I then provide a default value but
(perhaps more importantly) I can report easily on exactly which element was
in error and what the value encountered was. Requires a bit more coding but
no speed penalty because under the covers that is what RPG is doing anyway.
You're right that I'm assuming documents that will fit into memory. Iadmit I haven't really explored the nuances of using XML-INTO with a
handler; if I needed a handler anyway, I would be inclined to use XML-SAX.
I don't understand why you would switch to -SAX for that. The logic is
only marginally different to use -INTO with a handler and has the advantage
that you can deal with the document in pieces if desirable. e.g. Trigger a
process as each element group is processed as opposed to waiting until the
end of the XML-INTO. -SAX requires a lot more work.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
--
This is the RPG programming on the IBM i (AS/400 and 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.
As an Amazon Associate we earn from qualifying purchases.
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.