We yearn for i6.1.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Saturday, 1 August 2009 9:49 a.m.
To: RPG programming on the IBM i / System i
Subject: Re: XML-INTO woes

If you are on IBM i 6.1, there's a PTF that might help you. It lets you

specify a "countprefix" option that will give you the count of elements
filled in for an array. If there are 0 elements provided by the caller,

it'll be set to 0. Might be what you're looking for.


Peter Connell wrote:
The XML-INTO handler some things for which I am most grateful which
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

It does not fail if there are elements defined in my structure that
missing in the xml document.
It does not fail if there are elements not defined in my structure
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
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"

Because the DTD does not rigidly constrain users of the originating
service that all elements must be supplied, even if unpopulated, then
handler can only process elements based on their content.
Because missing elements have gone "bad" then examining their content
make I required decision is meaningless.

What I have not seen is any advice that the handler will fail to
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
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.


-----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

adjacent memory) and you should not use them. Using them would be

The number of elements that are passed to your %HANDLER is given to
in the 3rd parameter to your procedure.

Peter Connell wrote:

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
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.

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.

The missing name elements get populated with whatever might be found
some other element.

This is disastrous , since fields are then presented to the code in
handler containing rubbish.

Of course, I have compile the XML-INTO with the XmlOptions parameter
allow for missing elements as follows.

D XmlOptions C 'allowmissing=yes
D doc=file

This issue must surely have arisen before on this forum but I can't

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



Visit our website www.vedaadvantage.com. It has a new design with
improved navigation and search capabilities; and customer friendly
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
or legally privileged information, or both. No confidentiality or
privilege is waived
or lost by any mistransmission. If you receive this correspondence in
error, please
immediately delete it from your system and notify the sender. You
not disclose,
copy or rely on any part of this correspondence if you are not the
intended recipient.
Any views expressed in this message are those of the individual
sender, except where
the sender expressly, and with authority, states them to be the views
of Veda Advantage.
If you need assistance, please contact Veda Advantage on either :-
Australia 1300-921-621 or New Zealand +64 9 367 6200

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 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].