For the situation where the XML document does not have sufficient
XML elements or attributes for the subfields of an RPG data structure,
you can use the
allowmissing option to indicate whether
this is considered an error. XML data is considered to be missing
in the following circumstances:
- For an XML element matching an RPG data structure (including a
data structure subfield), if the XML element does not have attributes
or child elements for all RPG subfields.
- For XML data matching an array subfield of an RPG data structure,
if the number of XML elements is less than the dimension of the RPG
subfield array.
If expected XML data is not found, and 'allowmissing=yes' is not
specified, the operation will fail with status 00353 (XML does not
match RPG variable).
Tip: The countprefix option can also be used to handle
the situation where the XML document might not have sufficient XML
data for every subfield in the data structure.
To allow fewer array elements for the array specified on the XML-INTO
operation, it is not necessary to specify 'allowmissing=yes'. If the
XML document contains fewer elements than the RPG array, the operation
will not fail. The "Number of XML Elements" subfield in positions
372 - 379 of the PSDS can be used to determine the number of elements
successfully set by the operation.
- no indicates that XML data
must be present for every subfield of a data structure (including
subfields of data structure subfields), and XML data must be present
for every element of every subfield array.
- yes indicates that when XML data is not present for every
subfield and subfield array element, the operation will not fail.
If a variable is specified as the first operand of XML-INTO, the unset
subfields will hold the same value they held before the operation.
If %HANDLER is specified as the first operand of XML-INTO, the unset
subfields of the array passed to the handling procedure will have
the default value for the type (zero for numeric values, *LOVAL for
date values and so on).