|
The XML-INTO handler some things for which I am most grateful which are
clearly documented at Boulder.
It loads the data structure I give it with the required number of
occurrences of an element (and children) capped at the number of
dimensions in the array I give it so that it fires only when that cap is
reached.
It does not fail if there are elements defined in my structure that are
missing in the xml document.
It does not fail if there are elements not defined in my structure that
present in the xml document.
It tells me how many elements it loaded into my array.
I tell my handler to use data I expect to find in each element in the
structure I have defined.
Because it does not tell me which elements were missing then my handler
cannot know this.
It is a reasonable assumption that these would simply be unpopulated
since I don't recall any documentation that indicates this is "bad"
data.
Because the DTD does not rigidly constrain users of the originating web
service that all elements must be supplied, even if unpopulated, then my
handler can only process elements based on their content. Because missing elements have gone "bad" then examining their content to
make I required decision is meaningless.
What I have not seen is any advice that the handler will fail to supply
correct data (or supply corrupt data) if supplied with an xml document
that has missing elements when the associated array has a dimension
greater than 1.
Since our DTD has existed for years, there can be no thought of now
restricting it.
If I had known about this "bad" data limitation I would have stuck to a
good old SAX technique.
Apart from that, what the compiler does with an XML-INTO operation is
simply divine.
So for the moment I shall tolerate the overhead of having the handler
fire for every iteration of a multi-occurrence element.
Peter
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Saturday, 1 August 2009 5:22 a.m.
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO woes
Hi Peter,
XML-INTO will fill in only the elements that it found in the XML document. The remaining elements in your array are undefined (point to
adjacent memory) and you should not use them. Using them would be
"bad."
The number of elements that are passed to your %HANDLER is given to you in the 3rd parameter to your procedure.
Peter Connell wrote:
HELP.in
I have a major deadline to meet and have now discovered that my
%XML-INTO handler routine is not working as expected.
The handler has been defined to process a DIM(40) array.
This appears to have been working until now when an investigation of a
decimal data error reveals that the data structure that the data
structure passed to the handler is corrupted when subsequent elements
the xml document are missing.in
For example, a person-name element may contain 1st 2nd an last names
one occurrence but on the next may only contain the last name.in
The missing name elements get populated with whatever might be found
some other element.the
This is disastrous , since fields are then presented to the code in
handler containing rubbish.to
Of course, I have compile the XML-INTO with the XmlOptions parameter
allow for missing elements as follows.-
D XmlOptions C 'allowmissing=yes allowextra=yes
D doc=filecase=any
path='find
This issue must surely have arisen before on this forum but I can't
it.DIM(1)
I have just been advised that a workaround is to set the array to
so that the handler is call for each element of a multiple element xmlimproved navigation and search capabilities; and customer friendly
structure.
Regards,
Peter
Visit our website www.vedaadvantage.com. It has a new design with
interface with more relevant insights and solutions to help you make
informed decisions.
########################################################################
#############
This correspondence is for the named person's use only. It may containconfidential
or legally privileged information, or both. No confidentiality orprivilege is waived
or lost by any mistransmission. If you receive this correspondence inerror, please
immediately delete it from your system and notify the sender. You mustnot disclose,
copy or rely on any part of this correspondence if you are not theintended recipient.
Any views expressed in this message are those of the individualsender, except where
the sender expressly, and with authority, states them to be the viewsof Veda Advantage.
If you need assistance, please contact Veda Advantage on either :-
Australia 1300-921-621 or New Zealand +64 9 367 6200
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.