× 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 2010/11/23 11:05 AM, sjones@xxxxxxxxxxxxxx wrote:
This is my first attempt at reading xml using RPG& I am missing
something. Below is some of the xml document, not the entire file,& my
program that I am trying to display for now the values. It displays
blanks for both fields.


Steve, the path option has to point to the XML element that matches your data structure.

Try Path=BODS/BOD/PurchaseOrder

By the way, if you are on v6r1 or v7r1, consider using allowmissing=no (or taking the default for that option). Instead of allowing anything to be missing from the XML, use the countprefix option to handle any values that you really do want to allow to be missing from the XML.

Say it was ok for the DocumentPurposeCode to be missing, then you'd code your data structure like this, adding the numeric NumDocumentPurposeCode subfield to be used as a counter for the number of times (zero or one) that DocumentPurposeCode was set by XML-INTO:

d PurchaseOrderHeader_t...
d ds Qualified
d based(Template)
d DocumentPurposeCode...
d 2a
D NumDocumentPurposeCode...
D 10i 0
...

And then you'd code option countprefix=Num. After the XML-INTO, NumDocumentPurposeCode would be zero or one depending on whether that tag had been in the XML document or not. You'd add a Num<fldname> subfield for each subfield you wanted to allow missing from the XML, or in the case of arrays, if you wanted to allow the XML to have fewer than the DIM).

The countprefix option is really useful if you have array subfields to handle repeating elements in the XML document. It's much easier in the long run than trying to figure out how many elements there are by some other mechanism.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.