× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 4/21/2012 1:13 PM, Klugman, Luke wrote:
Hi joe,

As per your comment below:

"Generally speaking, RPG doesn't initialize data structure elements
unless you specifically tell it to. In the case of the XML-INTO, it
doesn't initialize the children of an element until it actually accesses
that element. "

I understand what your saying but my understanding is that the countprefix is there to tell you if an element is present or not - so if it is missing I would expect zero.

I have tried this out and can see it does this if in my example I had a countpeanut and the was no peanut, but at the same time babyNut would still be blank, but I would have thought the XML into should also set it to zero as it is missing. It seems to only deal with what is missing at the highest level.

Sort of. It sets the count elements if the containing tag is present. For example:

<top>
<middle>
<bottom>
<tagtoccount />
</bottom>
</middle>
</top>

If you have a count variable for tagtocount, then as long as bottom is specified that variable will be set. So this will set it to zero:

<top>
<middle>
<bottom />
</middle>
</top>

Neither of these will:

<top>
<middle />
</top>

<top />

Otherwise, the XML parser would have to start by running through every level of the document and setting the appropriate variables. That's a lot of overhead, and I think I'm okay that it doesn't do that by default. As noted, you can clear the variables yourself or initialize them using INZ.

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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.